how to read specifiied values from xls file?

1 回表示 (過去 30 日間)
ajay Hiremath
ajay Hiremath 2015 年 1 月 30 日
コメント済み: ajay Hiremath 2015 年 1 月 30 日
hello all... I want to read lumi and green values from xls file and I used this code...
fid=fopen('newFile11.xls', 'w');
fprintf(fid,'\n%d\t%d\t%d\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t%0.3f\t\n', area(i),Length,width,Perimet(i),AspectRat,FormFact(i),Entropy,stats1.Contrast,stats1.Energy,stats1.Homogeneity,stats1.Correlation,green,lumi );
fclose(fid);
%save('leaffff.mat', 'leafname');
% ///////////////////////////////////////////////////////////////////////////
%Load the sample data
datapresent = xlsread('newFile11.xls');
%grn = datapresent(1,12);
%lum = datapresent(1,13);
grn=green;
lum=lumi;
but it is giving.....
File C:\Users\use\Documents\MATLAB\lrc\newFile11.xls not in Microsoft Excel Format. error so how can I do tis.....thank you in advance

採用された回答

Hikaru
Hikaru 2015 年 1 月 30 日
This happens when you use fprintf to save a file in .xls extension.
To solve this, use xlswrite to write the data into Excel and then use xlsread to read it.
  1 件のコメント
ajay Hiremath
ajay Hiremath 2015 年 1 月 30 日
sir I m doing the same thing as you said but m getting this error.... ???error: CAT arguments dimensions are not consistent
the code im using for this is....
filename = 'testdata.xlsx';
A = {'Area','Length','width','perimet','Aspectrat','Form_fact',
'Entropy','Contrast','Energy','homogen','Green','Lumin'; area(i);
Length; width; Perimet(i); AspectRat; FormFact(i); Entropy;
stats1.Contrast; stats1.Energy; stats1.Homogeneity; stats1.Correlation;
green; lumi};
sheet = 1;
xlswrite(filename,A,sheet);

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

その他の回答 (0 件)

カテゴリ

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