division of uploaded excel file

Hi all, well i want to upload excel file and then divided it in parts, the excel file contains text and numerical data, i wrote a code but it doesn't work so any idea would be great.
[Yield,txt,alldata]=xlsread('Book2','Yield'); a=length(txt(1,:)) i=1;
while(i<=a) txt(1,i)=Yield(:,i+1); i=i+1; end

4 件のコメント

Hikaru
Hikaru 2014 年 8 月 22 日
The filename has to contain the file extension as well. Something like this:
xlsread('Book2.xlsx','Yield')
Giorgi
Giorgi 2014 年 8 月 22 日
The problem is not that, that's ok, the problem is that in this code txt(1,i)=Yield(:,i+1);. For example txt(1,;)='first' and Yield(:,i+1)=[3.4;4.6;2.7] well it says that it can't be create variable called as first that contains [3.4;4.6;2.7].
Hikaru
Hikaru 2014 年 8 月 22 日
I am not sure I understood your problem. How about providing us with sample values of Yield, txt, and alldata for a starter?
And tell us what kind of error does matlab give?
Giorgi
Giorgi 2014 年 8 月 22 日
I uploaded excel file for you and now i want to upload it and divide it into three variables called as first second and third and assign them the data that is below them in the excel file.

サインインしてコメントする。

 採用された回答

Hikaru
Hikaru 2014 年 8 月 22 日

0 投票

[Yield,txt,alldata]=xlsread('Book2','Yield');
a=length(txt(1,:))
for i=1:a
assignin('base',[txt{i}],Yield(:,i));
end

1 件のコメント

Giorgi
Giorgi 2014 年 8 月 22 日
Well that works thanks a lot

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import from MATLAB についてさらに検索

質問済み:

2014 年 8 月 22 日

コメント済み:

2014 年 8 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by