Problem in reading data from Excel sheet and copying it in 2d array

3 ビュー (過去 30 日間)
sana
sana 2013 年 5 月 21 日
AOA,
P = [ 138 6.31210089 6 0 0.2 0;
202 6.31210089 6 0 0.2 0;
264 6.31210089 6 0 0.2 0;]';
T =[1 2 3];
Here, the matrix has 3 columns, and 6 rows. But when i try to get the same data from excel file which is in 2d form, the first column above is considered as a row i.e. after getting data from excel my P matrix is 3 x 6 i.e. 6 columns and 3 rows. But i want the data matrix to be of 6 x 3.
Following is my code to read data from excel sheet and copying it to array P.
[NUMERIC1,TXT1,RAW1]=xlsread('D:\Mphil CS\Semester 2\Machine Learning\Data\small data.xlsx');
%copying data from the Numeric array to P
for i = 1: 1:1110
for j = 1: 1 : 61
P(i,j) = NUMERIC1 (i,j);
end
end
How to get data in that form, and i can't take transpose.
  2 件のコメント
bym
bym 2013 年 5 月 21 日
why can't you take the transpose?
sana
sana 2013 年 5 月 22 日
my bad i realized afterwards that i can take the transpose.:)

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

採用された回答

bym
bym 2013 年 5 月 21 日
reverse i & j ?
%copying data from the Numeric array to P
for i = 1: 1:1110
for j = 1: 1 : 61
P(i,j) = NUMERIC1 (j,i); % reversed i & j
end
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by