フィルターのクリア

Xlsread and Strcuture

2 ビュー (過去 30 日間)
KKR
KKR 2011 年 3 月 24 日
Hi Guys,
Hope you are all doing fine. I have two primary questions, as I am a new user to MATLAB, and could not find satisfactory answer in help files.
1, I am trying to import data from excel file and I basically need flexibility in terms of user, will define the number of worksheet he wants data from. All worksheets has different no. of rows and I am wondering how can i use END argument in xlsread function, to make sure user will be able to import all the raws. For example, I have the following for one worksheet:
cstr = xlsread('opt56.xls',1,'B1:B47545');
And I would like to change that argument to ensure that everything is covered. B1:B:End ...something like that, not sure of exact syntax.
2, I used to use s-plus(similar to R), all the time for my statistical purpose, and now I am getting my hands on MATLAB. But facing a problem of working with Matrices as opposed to data frames as for dataframe I could simply refer to column with their names and have text and numbers in same dataframe. Of course I can have vectors in matlab and use them by their names/titles, but not with whole matrix and thus sometimes filtering of data becomes cumbersome. I am sure, MATLAB structure would be helpful to over come this problem, but I need some help on using structure for this purpose. My data is not that complex, its for regression purpose, so basically I have titles and column vectors. Any help?
Thank you for having such a great active community.
Kaushal

回答 (3 件)

the cyclist
the cyclist 2011 年 3 月 24 日
For your second question, try
doc dataset
to read about dataset arrays, which may help you.

Kaustubha Govind
Kaustubha Govind 2011 年 4 月 1 日
To answer your first question - I don't think there is a MATLAB function to help with this, but you might be able to use the Excel COM API by starting it as a COM server from MATLAB, to find the range of a column.

mohammed
mohammed 2011 年 4 月 1 日
for your first question
in your excel file store the number of rows using count function at cell for example "a1" use the following code to get your data
EOF = xlsread('data1.xls', 1, 'a1');
StartRange={'a2'};
EndRange={':a'}
Range=strcat(StartRange,EndRange,num2str(EOF));
targets = xlsread('data1.xls', 1, char(Range));

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by