Prev: Error message: Warning: Initializing Java preferences failed in matlabrc.
Next: Warning: No display specified. You will not be able to display graphics on the screen.
From: Matteo on 21 May 2010 11:58 I wrote this code data=repmat([1:1:5],5,1); test.input=[]; test.output =[]; for i=1:5 test.input(:,:,i)= data(:,:); test.output(:,:,i)=data(:,:).*i; name = ['lwp_',num2str(i),'.txt']; dt = test.output(:,:,i); save name dt; end clear i name dt; What I would like to get out of this is 5 text files named out1.txt, out2.txt, etcetera, with each one containing the (i)th output, that is test.output(:,:,1),test.output(:,:,2), etcetera What I get instead is a single name.mat file. COnversely, if I replace save name dt; with save (name, dt); I get this error message ??? Error using ==> save Argument must contain a string. Any hints as to how I could achieve my intended result? Thank you
From: Matteo on 21 May 2010 12:46 My question below should have been: What I would like to get out of this is 5 text files named lwp1.txt, lwp2.txt, etcetera, with each one containing the (i)th output, that is test.output(:,:,1),test.output(:,:,2), etcetera "Matteo " <matteo.niccoli(a)gmail.com> wrote in message <ht6aic$j7v$1(a)fred.mathworks.com>... > I wrote this code > > data=repmat([1:1:5],5,1); > test.input=[]; > test.output =[]; > for i=1:5 > test.input(:,:,i)= data(:,:); > test.output(:,:,i)=data(:,:).*i; > name = ['lwp_',num2str(i),'.txt']; > dt = test.output(:,:,i); > save name dt; > end > clear i name dt; > > What I would like to get out of this is 5 text files named out1.txt, out2.txt, etcetera, with each one containing the (i)th output, that is test.output(:,:,1),test.output(:,:,2), etcetera > > What I get instead is a single name.mat file. > COnversely, if I replace > save name dt; > with > save (name, dt); > > I get this error message > ??? Error using ==> save > Argument must contain a string. > > Any hints as to how I could achieve my intended result? Thank you
From: Steven Lord on 21 May 2010 13:41 "Matteo " <matteo.niccoli(a)gmail.com> wrote in message news:ht6aic$j7v$1(a)fred.mathworks.com... >I wrote this code > > data=repmat([1:1:5],5,1); > test.input=[]; > test.output =[]; > for i=1:5 > test.input(:,:,i)= data(:,:); > test.output(:,:,i)=data(:,:).*i; > name = ['lwp_',num2str(i),'.txt']; > dt = test.output(:,:,i); > save name dt; Use the _function_ form of SAVE, not the _command_ form. save(name, 'dt') -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Matteo on 21 May 2010 14:02
Thank you! This one worked for me: save (name, 'dt', '-ASCII'); "Steven Lord" <slord(a)mathworks.com> wrote in message <ht6gk9$skj$1(a)fred.mathworks.com>... > > "Matteo " <matteo.niccoli(a)gmail.com> wrote in message > news:ht6aic$j7v$1(a)fred.mathworks.com... > >I wrote this code > > > > data=repmat([1:1:5],5,1); > > test.input=[]; > > test.output =[]; > > for i=1:5 > > test.input(:,:,i)= data(:,:); > > test.output(:,:,i)=data(:,:).*i; > > name = ['lwp_',num2str(i),'.txt']; > > dt = test.output(:,:,i); > > save name dt; > > Use the _function_ form of SAVE, not the _command_ form. > > save(name, 'dt') > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com > |