Gistlib Logo

gistlib

write me a function with a for loop that reads in a text file in matlab

main.m
function readTextFile(filename)
    fid = fopen(filename, 'r');
    tline = fgetl(fid);
    while ischar(tline)
        disp(tline)
        tline = fgetl(fid);
    end
    fclose(fid);
end
189 chars
10 lines

similar matlab code snippets

how to write a for loop to loop to the end of a file in matlab
loop through all files in folder and list those which end with .m in matlab
calculate the frequency of letters in words in matlab
how to replace each element in a array with the row of another array in matlab
while loop in matlab
how to count from -1 to 101 in matlab
implement factorial in matlab
find the thirteen adjacent digits in the 1000-digit number that have the greatest product. what is the value of this product? in matlab
loop to find integers in matlab
how to replace each element of a array with the row cell of another array in matlab

related categories

matlab
file-io
loops

gistlibby LogSnag