Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Importing Matrx with headers from Excel

Subject: Importing Matrx with headers from Excel

From: Hugh

Date: 9 Oct, 2012 18:23:05

Message: 1 of 3

I have a data set where 10 maturires, 1:10 have rates for each date over a 5 year period.

The rate are in the first row of each column and the dates in the first column of each row.

 Is there a way to import the matrix so that the headers and dates stay "linked" to the data?

i.e. so that the 5y rates know which rate in linked to which date etc.

Would a struct be the best solution in this situation?

Another problem is that some of the rates are missig and are shown as "#N/A" in excel. How will Matlab interprate these?

I want the missing rates to keep their place in the maturity/date matrix but I want then to tacke some kind of null value so that I can deal with them later.

Subject: Importing Matrx with headers from Excel

From: dpb

Date: 9 Oct, 2012 19:27:17

Message: 2 of 3

On 10/9/2012 1:23 PM, Hugh wrote:
> I have a data set where 10 maturires, 1:10 have rates for each date over
> a 5 year period.
>
> The rate are in the first row of each column and the dates in the first
> column of each row.
>
> Is there a way to import the matrix so that the headers and dates stay
> "linked" to the data?
>
> i.e. so that the 5y rates know which rate in linked to which date etc.
>
> Would a struct be the best solution in this situation?
>
> Another problem is that some of the rates are missig and are shown as
> "#N/A" in excel. How will Matlab interprate these?
>
> I want the missing rates to keep their place in the maturity/date matrix
> but I want then to tacke some kind of null value so that I can deal with
> them later.

Possible to use a structure, but the headers aren't "linked" to the data
now; they're simply positionally related visually.

If you read in the rates as a vector 1:N and the data as an array w/ the
first column holding the date, they're still "linked" by that same 1:N
association of column to heading other than the data would be in column
2:N+1. You can, of course, also keep the dates in a column vector its
own and then the columns are still 1:N.

As for the missing data, you can use NaN or pick some other convenient
value as a replacement...

--

Subject: Importing Matrx with headers from Excel

From: Hugh

Date: 10 Oct, 2012 18:29:08

Message: 3 of 3

Thanks dbp

dpb <none@non.net> wrote in message <k51tpe$s8o$1@speranza.aioe.org>...
> On 10/9/2012 1:23 PM, Hugh wrote:
> > I have a data set where 10 maturires, 1:10 have rates for each date over
> > a 5 year period.
> >
> > The rate are in the first row of each column and the dates in the first
> > column of each row.
> >
> > Is there a way to import the matrix so that the headers and dates stay
> > "linked" to the data?
> >
> > i.e. so that the 5y rates know which rate in linked to which date etc.
> >
> > Would a struct be the best solution in this situation?
> >
> > Another problem is that some of the rates are missig and are shown as
> > "#N/A" in excel. How will Matlab interprate these?
> >
> > I want the missing rates to keep their place in the maturity/date matrix
> > but I want then to tacke some kind of null value so that I can deal with
> > them later.
>
> Possible to use a structure, but the headers aren't "linked" to the data
> now; they're simply positionally related visually.
>
> If you read in the rates as a vector 1:N and the data as an array w/ the
> first column holding the date, they're still "linked" by that same 1:N
> association of column to heading other than the data would be in column
> 2:N+1. You can, of course, also keep the dates in a column vector its
> own and then the columns are still 1:N.
>
> As for the missing data, you can use NaN or pick some other convenient
> value as a replacement...
>
> --

Tags for this Thread

No tags are associated with this thread.

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.

Contact us