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!