Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Export Time Series ASCII from Matlab for Excel

297 views
Skip to first unread message

Sue

unread,
Dec 12, 2009, 12:15:07 PM12/12/09
to
Hi,

I have imported a file from Excel into Matlab that consisted of 365 days worth of hourly tide readings giving me over 8500 rows of data. Once I read the file into Matlab for Time Series the data was averaged for each day giving me a file of daily averages resulting in 365 rows, one for each day of the year. I now need this data back in ASCII format for Excel for other use but I keep obtaining errors when trying to export the data. See below. All I am able to successfully do is save as a *.mat file which does not import into Excel. Any help would be appreciated.

x2005 is the array (lists the data correctly)

******************************************************
save my_data.out x2005 -ASCII
Warning: Attempt to write an unsupported data type to an ASCII file.
Variable 'x2005' not written to file.

******************************************************
dlmwrite('my_data.out',x2005, ';')
??? Error using ==> timeseries.subsref at 95
Time series can only be indexed using a single dimension. For example, ts(1:10);

Error in ==> dlmwrite at 177
rowIsReal = isreal(m(i,:));

******************************************************
csvwrite('csvlist.dat',x2005)
??? Error using ==> timeseries.subsref at 95
Time series can only be indexed using a single dimension. For example, ts(1:10);

Error in ==> dlmwrite at 177
rowIsReal = isreal(m(i,:));

Error in ==> csvwrite at 32
dlmwrite(filename, m, ',', r, c);

Wayne King

unread,
Dec 12, 2009, 12:51:06 PM12/12/09
to
"Sue " <srou...@gmail.com> wrote in message <hg0j2r$fag$1...@fred.mathworks.com>...

Hi Sue, I assume from the 1st error message that x2005 is a time series object; if you query its class

>>class(x2005)

does it return timeseries?

Is there any reason you have to keep these daily averages inside of the time series object, you should be able to extract the data as
x2005.Data and the times as x2005.Time. Can't you write those as ascii files? For example:

DailyData = x2005.Data;
save Dailydata DailyData -ascii

or you can use dlmwrite() by extracting the time data and time series data into a matrix

Time = x2005.Time;
Data = x2005.Data;
DataMatrix = [Time, Data];
dlmwrite('example.dat',DataMatrix,'\t');

Hope that helps,
Wayne

0 new messages