How to read 1st coloumn from excel sheet which contains 60x3 values.

10 ビュー (過去 30 日間)
krishnasri
krishnasri 2015 年 3 月 28 日
編集済み: per isakson 2015 年 3 月 28 日
I have an excel sheet which contains 60x3 values I want to read the entire first column and display it.. can somebody help me with the code
  1 件のコメント
Ace_ventura
Ace_ventura 2015 年 3 月 28 日
data=xlsread('filename.xlsx');
column1=data(:,1)

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

回答 (1 件)

per isakson
per isakson 2015 年 3 月 28 日
編集済み: per isakson 2015 年 3 月 28 日
Read the second column from the Excel file in the first example.
filename = 'myExample.xlsx';
columnB = xlsread(filename,'B:B')
Thus, why not first try
columnA = xlsread(filespec,'A:A')
and next
columnA = xlsread(filespec,sheet_name,'A:A')
Is Excel installed on your system?
  2 件のコメント
krishnasri
krishnasri 2015 年 3 月 28 日
編集済み: per isakson 2015 年 3 月 28 日
yes it is installed. when i tried reading in the same manner, it was displaying an error for the code:
Data = xlsread('A_ed.xls');
for i=1:60
col_l=xlsread(Data,'A:A');
for j=1:59
col_m=xlsread(Data,'B:B');
for k=2:60
col_n=xlsread(Data,'C:C');
d(i)=sqrt((l(k)-l(j))^2+(m(k)-m(j))^2+(n(k)-n(j)^2))
e=norm(d(i));
end
end
end
range1=strcat('A',num2str(i));
range2=strcat('C',num2str(i));
xlswrite('A_norm',d(i),'sheet1',range1)
error msg displayed is ??? Error using ==> xlsread at 122
Filename must be a string.
Error in ==> distance_calc at 7
col_l=xlsread(Data,'A:A');
per isakson
per isakson 2015 年 3 月 28 日
編集済み: per isakson 2015 年 3 月 28 日
"in the same manner" &nbsp No, you did not!
Concentrate on the reading problem first. Don't involve calculations and writing. It's just confusing.
Given
  • The name of the file is 'A_ed.xls'.
  • The workbook has one sheet or the data is in the first sheet
Am I correct? If so try
data = xlsread( 'A_ed.xls', 'A:A' );
and inspect the content of the variable data
plot( data )

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

カテゴリ

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