[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Saving output of every loop to a file
From: |
Juan Pablo Carbajal |
Subject: |
Re: Saving output of every loop to a file |
Date: |
Mon, 19 Mar 2012 08:56:58 +0100 |
On Mon, Mar 19, 2012 at 8:52 AM, Juan Pablo Carbajal
<address@hidden> wrote:
> On Mon, Mar 19, 2012 at 8:23 AM, ksr <address@hidden> wrote:
>> hello guys,
>> i am trying to save output of a every looping to a file, with the following
>> code
>>
>> start = 1;
>> stop = win_length;
>> [y, fs] = wavread("eg.wav");
>> for i=1:win_length
>> y = abs(fft(x(start:stop).*fft_win));
>> start = stop +1;
>> stop = stop + win_length;
>> save('-text',dbout(i).txt, 'y');
>> end
>>
>> but the ouput in dbout(i), is expected to save like
>> dbout(1).txt
>> dbout(2).txt
>> dbout(3).txt
>> .
>> .
>> .
>>
>> but its not happening like that
>> please help me how to save this to a new file for every looping
>> Thanks in advance....
>>
>> --
>> View this message in context:
>> http://octave.1599824.n4.nabble.com/Saving-output-of-every-loop-to-a-file-tp4483989p4483989.html
>> Sent from the Octave - General mailing list archive at Nabble.com.
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>
> I think your save command is overwriting your output. Try adding
> "-append" as an option.
> check "help save" for more info
>
> --
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Zürich
> http://ailab.ifi.uzh.ch/carbajal/
... or
if you want to save each loop into different file (wouldn't recommend
it). You need to create the file name as a string, which you are not
doing.
instead of dbout(i).txt
you heve to do
["dbout(" num2str(i) ").txt"]
or
sprintf("dbout(%d).txt",i);
--
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/