from 8760 x 1 to 1 x 8760 ??

2 ビュー (過去 30 日間)
federico
federico 2013 年 10 月 22 日
編集済み: Image Analyst 2013 年 10 月 22 日
I have wind speed data over the year in an excel's coloumn (8760 X 1) and i need to import it in matlab. The problem is that MATLAB Simulink reads the data across the matrix so i need to transpose the matrix, go from 8760 x 1 to 1 x 8760 and also MATLAB reads the first row of the matrix as the time step so i need to convert the 1 x 8760 to a 2 x 8760 where the first row is the time step eg: 1 2 3 4 5 6 7 8 9 10 …………. I need a help, please, Thank you very much

回答 (2 件)

sixwwwwww
sixwwwwww 2013 年 10 月 22 日
編集済み: sixwwwwww 2013 年 10 月 22 日
Dear you can do like this(if i understood correctly):
num = xlsread('filename.xls', 'A:A');
ind = 1:length(num);
matrix = [ind; num'];
I hope it helps. Good luck!

Image Analyst
Image Analyst 2013 年 10 月 22 日
編集済み: Image Analyst 2013 年 10 月 22 日
To transpose use the apostrophe operator.
m = m';
To get the numbers sequentially use the colon operator
m2 = startingValue : stepValue : endingValue;
The step value is 1 if it's not explicitly given. So you want
out = [1:length(m); m'];

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by