Тёмный

textscan matlab 

Painless Programming
Подписаться 3,1 тыс.
Просмотров 32 тыс.
50% 1

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 44   
@BamaFanEdge
@BamaFanEdge 4 года назад
I've seen a couple comments asking about the header line causing problems. From the documentation, you can use "HeaderLines" to tell it how many lines to skip. For instance: S = textscan(fid, '%s %f %f %f %f %f %d', 'HeaderLines', 1, 'Delimiter', ',')
@PainlessProgramming
@PainlessProgramming 4 года назад
Fantastic. Thanks for sharing!
@dayslee8098
@dayslee8098 4 года назад
Really love the way you explain things, making things easy to understand !I am addicted !
@PainlessProgramming
@PainlessProgramming 4 года назад
Thanks so much! Happy programming.
@fatimahismael174
@fatimahismael174 2 года назад
thank you for your video.
@aliosmanbayir6009
@aliosmanbayir6009 Год назад
Hello, thanks for your helpful video... I have approximately 2000 txt file and I want to upload them into matlab but I'm having difficulties with that .. how I can do this ?
@amitanshupattanayak9065
@amitanshupattanayak9065 6 лет назад
great video. Love your way of explaining things
@BamaFanEdge
@BamaFanEdge 4 года назад
The syntax you show for selecting a value from the column, S{1}{1}, only seems to work for strings. How can I make it work on doubles or ints?
@PainlessProgramming
@PainlessProgramming 4 года назад
The %s stands for strings, %d for doubles or ints, %f for floating point numbers. So just replace the %s in the textscan line with a %d
@Nurlanbai
@Nurlanbai 3 года назад
It really is painless. Thanks a lot!
@emilyread6989
@emilyread6989 5 лет назад
Hi Heather Thank you so much for your videos, they have been so useful for learning to use MATLAB! I really like the way you explain things! I have a 4 GB text file that I need to analyse. Because of its size, I can't open it on MATLAB, EViews or Excel. I have been told to open it in 'parts', possibly using textscan. I have followed your steps and it just says S = {0 x 1} {0 x 2} etc, so it can't read any of my columns. I wondered if you know how to open a file in parts please? Thank you so much for your help! Emily
@PainlessProgramming
@PainlessProgramming 5 лет назад
Hello Emily. I would recommend opening the file in MATLAB with fopen and then reading a line at a time with fgets or fgetl. line = fgetl(file_id) or line=fgets(file_id) If your analysis can be done reading a line at a time and looking for important info, this should work. If you want to use MATLAB to break the file up into smaller files, you could open it for reading and use another fopen command to open a new file for writing. Use a loop and every time you read in a line from the large input file, write it to a new file. Your loop can control how any times you repeat this and add your info to the smaller file. Hope this makes sense.
@juansuescun9808
@juansuescun9808 6 лет назад
Quick question, how did you manage for textscan to not read the first line of the file but instead immediately jump to the dates and prices?
@PainlessProgramming
@PainlessProgramming 6 лет назад
For this example I just deleted the first row by hand. But if you want the MATLAB code to read in the header, you could add a line like: headers=fgetl(fid) before the textscan line.
@addypmf
@addypmf 5 лет назад
Omg!! Thanks, it looks pretty easy!! :D
@ramirovilaseca6824
@ramirovilaseca6824 6 лет назад
Thank you so much, please, keep doing matlab videos, i love how you explain things, greetings from Argentina
@PainlessProgramming
@PainlessProgramming 6 лет назад
Thanks for the positive feedback! :)
@MahmoodShafi0
@MahmoodShafi0 4 года назад
Can I read live CSV (Cpu temp) with this ?
@Rainstorm121
@Rainstorm121 4 года назад
Thanks. Can textread used instead of text scan?
@PainlessProgramming
@PainlessProgramming 4 года назад
The mathworks website on textread suggests that you use textscan instead. www.mathworks.com/help/matlab/ref/textread.html
@itzikovadia851
@itzikovadia851 4 года назад
pretty good thanks a lot u help me so much!!!
@tapanpatel7410
@tapanpatel7410 5 лет назад
Hello, while using 'testscan', how did it ignore first line in text file?
@PainlessProgramming
@PainlessProgramming 5 лет назад
For this example I just deleted the first row by hand. But if you want the MATLAB code to read in the header, you could add a line like: headers=fgetl(fid) before the textscan line.
@tapanpatel7410
@tapanpatel7410 5 лет назад
@@PainlessProgramming thank you so much. have a nice day
@ankitchauhan383
@ankitchauhan383 4 года назад
Thanks for video, Hi, Heather I have text file say data.1txt where look like have some text in few lines then step temperature volume 0 300 20 1 301 40 2 250 78 ... 100 582 60 then some text average number simulation end. Now I want only extract data from step 0 to 100 . How can I do that? Thanks,
@PainlessProgramming
@PainlessProgramming 4 года назад
Hello Ankit, If you are using textscan like the video does, your line of code to read in the data will be something like: S = textscan(fid, '%d %d %d') use percent sign and d 3 times with spaces in between S is a cell array with all 3 columns of data. You can look at the first column with S{1}. If you only want the first 3 numbers, use S{1}(1:3) This will be a vector containing the numbers 0, 1, 2. If you want 0-100 you could look at S{1}(1:101). And you can look at the other columns with S{2}(1:101). and S{3}(1:101)
@ankitchauhan383
@ankitchauhan383 4 года назад
@@PainlessProgramming data will be something like !
@PainlessProgramming
@PainlessProgramming 4 года назад
@@ankitchauhan383 Sorry, didn't realize my full comment didn't make it to RU-vid I fixed the above.
@AnkitChauhan-wj5xx
@AnkitChauhan-wj5xx 4 года назад
@@PainlessProgramming Thank you so much :)
@naqibrahimi9958
@naqibrahimi9958 4 года назад
thans for the good video. Ah, you got a beautiful voice :) it made me to listen to it many times
@mayodada655
@mayodada655 3 года назад
amazing tutorial
@PainlessProgramming
@PainlessProgramming 3 года назад
Thanks so much!
@krishnachauhan2822
@krishnachauhan2822 4 года назад
can i use text files as location address o extract other data.
@amalbenfathallah3845
@amalbenfathallah3845 4 года назад
Thanks for the video! Can you make a video on how to read a wrl file? (IndexedFaceSet)
@kbeee2980
@kbeee2980 4 года назад
Thanks for the good work. But I have a similar data and am doing basically the same thing but am not able to extract the column as you did in the video
@PainlessProgramming
@PainlessProgramming 4 года назад
Delete any header information and only leave the data in the file. Another thing you can check: If you open a file for reading and get a -1 as a return value, it means the open didn't work and you won't be able to use textscan or any other commands to read from the file.
@kbeee2980
@kbeee2980 4 года назад
Please have done that but is still not working
@ahmadmasihghani2949
@ahmadmasihghani2949 6 лет назад
hi thanks for the video it is really nice, i have a huge data which i am trying to import it in matlab using textscan actually it is an asc file, it works but the problem is that after each row i have zero till the end of the data. Can you please help me?
@김다영-q7s
@김다영-q7s 4 года назад
YOU ARE AMAZING THANKS SO MUCH!! :)
@PainlessProgramming
@PainlessProgramming 4 года назад
Thank you very much! :) I appreciate the positive comment.
@Nebulori
@Nebulori 5 лет назад
Thank u
@mihas6705
@mihas6705 6 лет назад
Cool!
Далее
MATLAB - fgetl and fgets for reading a line of text
7:23
Lesson 8.2: Excel files in MATLAB
9:13
Просмотров 115 тыс.
Борщ в стиле высокой кухни!
00:57
Handsoms😍💕
00:15
Просмотров 4 млн
Matlab 20: File Operations - Read and Write
10:10
Просмотров 15 тыс.
Writing Output Statements in Matlab
16:32
Просмотров 11 тыс.
Textscan and Fscanf in Matlab
9:39
Просмотров 42 тыс.
Lesson 8.3: Text Files
12:18
Просмотров 116 тыс.
Import Data and Analyze with MATLAB
9:19
Просмотров 682 тыс.
Lesson 8.4 Binary Files (new version)
38:56
Просмотров 34 тыс.
How to Read, Write & Display Images in MATLAB
8:52
Просмотров 12 тыс.