help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: save both dates and numeric data


From: abigi
Subject: Re: save both dates and numeric data
Date: Mon, 12 Apr 2010 02:16:52 -0800 (PST)

Thanks!
I tested your code and it is more than a good hint: my numeric data is a
matrix, so I am adapting your lines to my needs (i.e. mat2cell etc..).

Thanks,

Alessandro

Jaroslav Hajek-2 [via Octave] ha scritto:

> On Mon, Apr 12, 2010 at 11:11 AM, abigi <[hidden email]
> <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1836865&i=0>>
> wrote:
>
> >
> > Dear Octave forum,
> >
> >  I am quite a beginner in Octave. I am using Octave 3.0.5 on a
> x86_64 pc
> > linux. I have quite a few numeric data (measurement) which I would
> need to
> > save into a text file according to the following structure of:
> >
> > 1st column -> dates
> > 2nd : 130th colums -> numeric data
> >
> > I had more than a look to datestr, save, fprintf but I had troubles
> with
> >
> >  - creating a matrix or something alike with that structure (1
> column of
> > date/character type data, other cols numeric data), so that I could
> save
> > straightly. I am doubting that is possible to have this kind of data...
> > something like a "dataframe" in R
> >
> >  - to generate a sequence of dates I have used strvcat + datestr,
> resulting
> > in a character vector: is that a good way to solve this issue?
> >
>
> Sure, why not?
>
> > - I have tried with merging everything in a string matrix, but then
> it was
> > getting even messier...
> >
> > Any suggestion is welcome, thanks,
> >
> >  Alessandro
> >
>
> You can handle tasks like this and much more with fprintf.
> Do something like this (not tested):
>
> dates = # NxK character matrix of dates
> numbers = # Nx129 numeric matrix of your numeric data
>
> ## prepare format of a single row
> format = ["%s", repmat(" %f", 1, 129), "\n"];
>
> ## prepare data sequentially, as it needs to be printed
> seq_data(1, :) = cellstr (dates);
> seq_data(2,:) = num2cell (numbers, 2);
>
> fprintf (fid, format, seq_data{:});
>
> hth
>
>
> --
> RNDr. Jaroslav Hajek, PhD
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1836865&i=1>
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
> ------------------------------------------------------------------------
> View message @
> http://n4.nabble.com/save-both-dates-and-numeric-data-tp1836839p1836865.html 
>
> To unsubscribe from save both dates and numeric data, click here
> <<Link Removed>>.
>
>


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alessandro Bigi
Dipartimento di Ingegneria Meccanica e Civile
University of Modena and Reggio Emilia
via Vignolese 905/b, I-41125 Modena
phone +39-059-2056328
fax   +39-059-2056126
email [hidden email]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



View this message in context: Re: save both dates and numeric data
Sent from the Octave - General mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]