|
Prev: Matlab FFT Calibration Routines
Next: surface plots
From: Rebecca on 5 May 2008 16:33 I'm having a similar issue that I was hoping this code would solve but I can't seem to figure it out. You wrote: > >> A=23; > >> fprintf('%03d\n', A) > 023 I need the number produced to be used to name files automatically as I collect data. I want files to be named filename01,filename02,filename03...filename23. I can get the filenames but they come out like this: filename1,filename2...filename23. Which causes problems when I try to later index 'which' iteration the file was (say I need to label things on a graph I get e1 instead of 01 (actually I get 81 because I'm using a date at the end of the filename but this isn't really important) This code doesn't seem to allow me to use the output in a filename (it comes out just filename with no #). If I use str2double I get NaN. Can you help me too?
From: Rebecca on 5 May 2008 16:37 I'm having a similar issue that I was hoping this code would solve but I can't seem to figure it out. You wrote: > >> A=23; > >> fprintf('%03d\n', A) > 023 I need the number produced to be used to name files automatically as I collect data. I want files to be named filename01,filename02,filename03...filename23. I can get the filenames but they come out like this: filename1,filename2...filename23. Which causes problems when I try to later index 'which' iteration the file was (say I need to label things on a graph I get e1 instead of 01 (actually I get 81 because I'm using a date at the end of the filename but this isn't really important) This code doesn't seem to allow me to use the output in a filename (it comes out just filename with no #). If I use str2double I get NaN. Can you help me too?
From: Walter Roberson on 5 May 2008 16:46 In article <fvnqtv$jnt$1(a)fred.mathworks.com>, Rebecca <rjones(a)gc.cuny.removeme.edu> wrote: >I need the number produced to be used to name files >automatically as I collect data. I want files to be named >filename01,filename02,filename03...filename23. for K=1:23 fid = num2str(K,'filename%02d.mat'); %create the name save(fid, 'fid', 'K'); %use the file somehow end -- So you found your solution What will be your last contribution? -- Supertramp (Fool's Overture)
From: someone on 5 May 2008 16:49 "Rebecca " <rjones(a)gc.cuny.removeme.edu> wrote in message <fvnr5f$3tm$1(a)fred.mathworks.com>... > I'm having a similar issue that I was hoping this code > would solve but I can't seem to figure it out. > You wrote: > > > >> A=23; > > >> fprintf('%03d\n', A) > > 023 > > > I need the number produced to be used to name files > automatically as I collect data. I want files to be named > filename01,filename02,filename03...filename23. I can get > the filenames but they come out like this: > filename1,filename2...filename23. Which causes problems > when I try to later index 'which' iteration the file was > (say I need to label things on a graph I get e1 instead of > 01 (actually I get 81 because I'm using a date at the end > of the filename but this isn't really important) > > This code doesn't seem to allow me to use the output in a > filename (it comes out just filename with no #). If I use > str2double I get NaN. > > Can you help me too? See Q 4.12 in the MATLAB FAQ at: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: Matlab FFT Calibration Routines Next: surface plots |