MATLAB Answers

How to use writetable command in a for loop

55 views (last 30 days)
Bhaskar panchireddi
Bhaskar panchireddi on 2 Jun 2016
Answered: Taha on 11 Jan 2017
while using writetable command in a for loop i'm able to save the text file only for the last iteration value. Hoe can i save all the text files using this writetable command?

Answers (2)

Taha
Taha on 11 Jan 2017
for m=1:10
test = [m:m+20];
T=table(test);
writetable(T,['test' num2str(m) '.txt'],'Delimiter','\t');
end
here is the solution! this code generates text files with the names: test1.txt, test2.txt.... using the for loop in MATLAB

  0 Comments

Sign in to comment.


Tags

No tags entered yet.


Translated by