Save multiple .dat files using for loop

조회 수: 2 (최근 30일)
Turbulence Analysis
Turbulence Analysis 2020년 8월 12일
댓글: Turbulence Analysis 2020년 8월 13일
Hi,
I intend to save multiple velocity .dat files, while handling single file, I used as follows dlmwrite('test.dat',[xxx yyy UUFFF1 VVFFF1]);, Now how to modify while savig multiple .dat files.. Could somebody please help me with this.. The result should save as test1.dat, test2.dat ....
for k = 1:1:10
UFF = X_filter(1:ni*nk,k);
VFF = X_filter(1+ni*nk:2*ni*nk,k);
UFF1 =reshape (UFF,ni,nk)';
VFF1 =reshape (VFF,ni,nk)';
UUFFF1 = reshape (UFF1, 4650,1);
VVFFF1 = reshape (VFF1,4650,1);
xxx = reshape (X,4650,1);
yyy = reshape (Y,4650,1);
dlmwrite(('test%d',k),'dat'[xxx yyy UUFFF1 VVFFF1]);
end

답변 (1개)

Sudheer Bhimireddy
Sudheer Bhimireddy 2020년 8월 12일
Try this:
fileName = sprintf('test%d.dat',k);
writematrix(your_matrix,fileName);
  댓글 수: 3
Sudheer Bhimireddy
Sudheer Bhimireddy 2020년 8월 12일
In that case use:
dlmwrite(fileName,your_matrix);
From MATLAB documentation:
dlmwrite is not recommended
Not recommended starting in R2019a
Turbulence Analysis
Turbulence Analysis 2020년 8월 13일
Hi,
Thanks it's working now..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by