How to create a struct matrix derived froma ascii file

2 次查看(过去 30 天)
Hi to all, I have this code for read a sequential ascii file (1500x1500) and substuite a NaN_value with 0 and rewrite that. Now I want introduce in the for cycle a string code to create a new variabile (maybe a structure matrix or something like that), with for each cell there is a 'history matrix' for these cells derived for each loaded ascii file.
if true
clear all
D = dir(fullfile('Daily_cum_*.asc'));
mkdir('displacement maps_NaN Value')
parfor k =1:numel(D)
fid = fopen(fullfile(D(k).name), 'rt');
filename = D(k).name ;
A=importdata(filename, ' ', 6);
B=A.data;
Nan_value = sscanf(A.textdata{6,1},'%*s %f');
DC = changem(B, 0, Nan_value);
C{k} = DC
cd('displacement maps_NaN Value');
dlmwrite(filename,DC, ' ');
cd ('..')
fclose(fid);
end
end
Is it possible ? I tried to do that with this code:
if true
for k =1:numel(D)
hh=0;
ggg=0;
for gg=1:1500
ggg=1+ggg;
fff=0;
for ff=1:1500
fff=fff+1;
hh=1+hh;
ridotta{k}(ggg,fff)=C{k}(gg,ff);
newdata2{hh}(k,1)=C{k}(gg,ff);
end
end
end
end
I'm not sure of results.
Thanks,
Stefano

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by