These videos are truly stellar! Information is delivered at a digestible rate without making the videos far too long. Thank you for helping me with my Master's Thesis in coastal engineering!
If you call fgetl twice, the first time you call it you will be reading in the first line. The second time you call it you will be reading in the second. line.
Thanks for watching the video. MATLAB will display any strings (something in quotes) in purple. In my video I had several strings: 1) fid=fopen('test.txt', 'r'); - This fopen command contains a string with the file name 'test.txt' and a string with 'r'- for reading mode. Both strings contain quotes around them. 2) fprintf('line=%s***', line); - The fprintf command contains a string with characters that will be printed just as they are in the string: line= and *** and special format specifier characters like %s or %d . A %s stands for a string and will substitute the contents of the variable line in place of %s. 3) fscanf(fid, '%d', [1 3]); - The fscanf command contains a string with %d, this indicates that the data read in from the file will be integers (no decimal places)
@@PainlessProgramming That's really kind of you to reply - thank you. Sorry for the brevity of my initial question. I was getting more and more frustrated as I'd been search matlab docs for hours. Normal strings I'm fine with, but I hadn't come across special format specifiers before you answered my question, so thank you very much. I've seen them used a lot without explanation and it can be confusing to a newbie ;-) I just searched matlab docs under 'special format specifiers' to see if there is a documents about them and I tried a few variations of the term, but nothing came up. Do you know what they may be called under the matlab help documents for me to read further? Thanks so much for your help Heather!
These videos are truly stellar! Information is delivered at a digestible rate without making the videos far too long. Thank you for helping me with my Master's Thesis in coastal engineering!
Thanks for taking the time to comment. Good luck with your thesis!
nice video
Thanks!
How can i take the second row with fgetl?
If you call fgetl twice, the first time you call it you will be reading in the first line. The second time you call it you will be reading in the second. line.
Thanks for the video. What is the code in purple? I don't understand what it is.
Thanks for watching the video.
MATLAB will display any strings (something in quotes) in purple. In my video I had several strings:
1) fid=fopen('test.txt', 'r'); - This fopen command contains a string with the file name 'test.txt' and a string with 'r'- for reading mode. Both strings contain quotes around them.
2) fprintf('line=%s***', line); - The fprintf command contains a string with characters that will be printed just as they are in the string: line= and *** and special format specifier characters like %s or %d . A %s stands for a string and will substitute the contents of the variable line in place of %s.
3) fscanf(fid, '%d', [1 3]); - The fscanf command contains a string with %d, this indicates that the data read in from the file will be integers (no decimal places)
@@PainlessProgramming That's really kind of you to reply - thank you. Sorry for the brevity of my initial question. I was getting more and more frustrated as I'd been search matlab docs for hours. Normal strings I'm fine with, but I hadn't come across special format specifiers before you answered my question, so thank you very much. I've seen them used a lot without explanation and it can be confusing to a newbie ;-)
I just searched matlab docs under 'special format specifiers' to see if there is a documents about them and I tried a few variations of the term, but nothing came up. Do you know what they may be called under the matlab help documents for me to read further? Thanks so much for your help Heather!
There is more info on format specifiers here www.mathworks.com/help/matlab/matlab_prog/formatting-strings.html