Thread Subject: Apply the codes of one sample to the whole dataset

Subject: Apply the codes of one sample to the whole dataset

From: Learner

Date: 20 Aug, 2008 03:27:31

Message: 1 of 2

,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:486346

Hi,

I have a large time-series data containing many funds. Now I have a
m.file that works for one sample fund (fund 1) to generate the values
of variable y. How can I do the samething for all the funds, and get
the result in one file, as below.

id x1 x2 x3 y
1 ... ... ... ...
1 ... ... ... ...
1 ... ... ... ...
2 ... ... ...
2 ... ... ...
2 ... ... ...
2 ... ... ...
2 ... ... ...
3 ... ... ...
3 ... ... ...

I thought about writing the data of each fund into matlab one by one,
and then repeat the code on the sample fund, and Concatenate the
results.

Is there any better way to do this?

Thanks!

Subject: Apply the codes of one sample to the whole dataset

From: ImageAnalyst

Date: 24 Aug, 2008 00:58:38

Message: 2 of 2

On Aug 19, 11:27=A0pm, Learner <cnfengshu...@gmail.com> wrote:
> Hi,
>
> I have a large time-series data containing many funds. Now I have a
> m.file that works for one sample fund (fund 1) to generate the values
> of variable y. =A0How can I do the samething for all the funds, and get
> the result in one file, as below.
>
> id =A0x1 x2 x3 =A0y
> 1 =A0 ... ... =A0... =A0...
> 1 =A0 ... ... =A0... =A0...
> 1 =A0 ... ... =A0... =A0...
> 2 =A0... ... ...
> 2 =A0... ... ...
> 2 =A0... ... ...
> 2 =A0... ... ...
> 2 =A0... ... ...
> 3 =A0... ... ...
> 3 =A0... ... ...
>
> I thought about writing the data of each fund into matlab one by one,
> and then repeat the code on the sample fund, and Concatenate the
> results.
>
> Is there any better way to do this?
>
> Thanks!

-----------------------------------
Learner:
Turn the m file into a function that can be called from another m file
- the main one. Have your main function run your function for every
fund, returning an array each time that you save into another 2D
array. Then write out the 2D array using xlswrite() or to a csv file
using fprintf().
Regards,
ImageAnalyst

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com