Matlab: Using 'dlmwrite' in a Loop -
suppose dlmwrite command has been used follows (period vector):
period=[10;20;30;40;50;60;70]; dlmwrite('parameters.tcl',['set tn {',num2str(period(n)),'}',''],'delimiter','','-append'); the output of above code n=1, writes below text in 'parameters.tcl':
set tn {10} now, want use dlmwrite in loop. example if n=2, wand output should be:
set tn {10 20} if n=3:
set tn {10 20 30} and on. how do?!
replace following fragment:
num2str(period(n)) with following:
strjoin(cellstr(num2str(period(1:n))), ' ')
Comments
Post a Comment