필터 지우기
필터 지우기

How to create a struct matrix derived froma ascii file

조회 수: 2 (최근 30일)
Stefano Alberti
Stefano Alberti 2016년 5월 18일
편집: Stefano Alberti 2016년 5월 18일
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