Load----problem in using this commad
古いコメントを表示
i have wriiten a code to load 100 txt files of a data and the line of code marked bold is not working ....plz help me..
for i=1:1:100
tmp=num2str(i);
f={'F'};
ze={00};
tx ={'.txt'};
if(i<10)
ze={'00'};
fnam=strcat(f, ze, tmp, tx);
else
if(i==100)
fnam=strcat(f, tmp, tx);
else
ze={'0'};
fnam=strcat(f, ze, tmp, tx);
end
end
* X = load(fnam)**BOLD TEXT*
end
2 件のコメント
Chandra Kurniawan
2011 年 11 月 28 日
You can't use 'load' command to import your txt files. Load command is used to load MAT-File only. Use fopen instead.
Walter Roberson
2011 年 11 月 28 日
"load" _is_ supported for text files that are written to be compatible in form with save -ascii
採用された回答
その他の回答 (1 件)
Fangjun Jiang
2011 年 11 月 28 日
Try this first to see if it is the problem regarding your file name construction.
for i=1:100
fnam=sprintf('F%03d.txt',i)
end
1 件のコメント
Walter Roberson
2011 年 11 月 28 日
And for those who prefer num2str to sprintf (even though num2str calls sprintf to do the work):
for i=1:100
fnam=num2str(i, 'F%03d.txt');
X=load(fnam)
end
カテゴリ
ヘルプ センター および File Exchange で Get Started with MuPAD についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!