フィルターのクリア

mutiple reshaping files and the output have similar name of the input files

2 ビュー (過去 30 日間)
Ahmad Abbas
Ahmad Abbas 2020 年 12 月 11 日
編集済み: Ive J 2020 年 12 月 14 日
i am loading more than 60 ASCII files. i want to reshape them but i want the output files from the reashing match the input files names or at least the number name in the files.
files name fv895,fv898,fv995...............
clear
files = dir('fv*.asc');
for i=1:length(files)
eval(['load ' files(i).name ' -ascii']);
sd=reshape(files(i).name,1,[]);
end
  3 件のコメント
Ahmad Abbas
Ahmad Abbas 2020 年 12 月 14 日
the eval was a mistake which i should not used it. i was trying to load all files then reshape them to do more anaylsing work.
Ahmad Abbas
Ahmad Abbas 2020 年 12 月 14 日
i am updating the code. i do not want to create many lines to reshape all the files. how i can create a loop to do it for me
%%
clear
files = dir('fv*.asc');
numfiles = length(files);
mydata = cell(1, numfiles);
for i=1:numfiles
load(files(i).name);
end
rfv1095=reshape (fv1095,1,[]);
rfv1098=reshape (fv1098,1,[]);
rfv1195=reshape (fv1195,1,[]);
rfv1195=reshape (fv1198,1,[]);
rfv1295=reshape (fv1295,1,[]);
rfv1295=reshape (fv1298,1,[]);
rfv1395=reshape (fv1395,1,[]);
rfv1395=reshape (fv1398,1,[]);
rfv1495=reshape (fv1495,1,[]);
rfv1495=reshape (fv1498,1,[]);
rfv1595=reshape (fv1595,1,[]);
rfv1595=reshape (fv1598,1,[]);
rfv1695=reshape (fv1695,1,[]);
rfv1695=reshape (fv1698,1,[]);
rfv1795=reshape (fv1795,1,[]);
rfv1795=reshape (fv1798,1,[]);
rfv1895=reshape (fv1895,1,[]);
rfv1895=reshape (fv1898,1,[]);
rfv1995=reshape (fv1995,1,[]);
rfv1995=reshape (fv1998,1,[]);

サインインしてコメントする。

採用された回答

Ive J
Ive J 2020 年 12 月 14 日
編集済み: Ive J 2020 年 12 月 14 日
I'm not aware of you file contents (or even whehter you can use load to read them). Regardless, you may need something like:
files = dir('fv*.asc');
mydata = cell(numel(files), 1);
for i = 1:numel(files)
mydata{i} = load(files(i).name); % still don't know if you need readtable, readcell, fread, etc instead of load
mydata{i} = reshape(mydata{i}, 1, []);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by