I need to use 'for loop' to read the names from a text file using 'fgetl' function. How do I do that?
显示 更早的评论
There is a list of 80 test subject names in a text file, and I have to use the for loop function to read the names of the first 40 subjects using fgetl function. How do I write the code in MATLAB.
Thanks!!
2 个评论
anukriti dureha
2013-6-2
do u specifically have to use for???... or u can use while loop too?
kiran sai kadiyala
2020-2-21
clear all
close all
clc
%importing data
f1=fopen('your_file.dat','r')
%n=no of rows in your file
n=218;
for i=1:n;
ab{i}=fgetl(f1);
end
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!