Combining consecutive vectors into a matrix
古いコメントを表示
I am trying to combine 108 consecutive vectors (100x1 double) into a matrix in such a way that I will get a 100x108 matrix. The vectors are called like HH_1, HH_2, etc., so I can do it by using M=[HH_1,HH_2,...], but this is really a lot of work for 108 vectors. Therefore, I was wondering if there is a short and easy way to perform this action. After I obtain the 100x108 matrix, I want to seperate this matrix into 100 rows, how can I do this easily?
4 件のコメント
Guillaume
2019 年 10 月 2 日
but this is really a lot of work for 108 vectors.
Indeed, and so it must have been a lot of work to create these HH_1, HH_2. The simple solution is not to create numbered variables in the first place. The code that created these variables is what needs fixing. Can you show it?
Lars Bouten
2019 年 10 月 2 日
Guillaume
2019 年 10 月 2 日
But you do you get then into matlab? Are they already saved in a mat file?
Lars Bouten
2019 年 10 月 2 日
採用された回答
その他の回答 (1 件)
You must have changed the options of the wizard to specifically create variables from the columns of the excel spreadsheet. Don't do that. Import the data as a table (best), or cell array and your problem will go away.
Or better, don't use the import wizard. Use readtable, readmatrix (if on a version new enough) or xlsread.
Obtaining your M matrix may be as simple as :
M = readmatrix(yourexcelfile);
If not, an example file would help us understand better.
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!