How to put 8 variables into a single matrix?
Show older comments
I have 8 variables each of them having dimension(65,1). I want to put them in a matrix of dimension(65,8). Please suggest me how to do it using matlab code.
Devendra
Accepted Answer
More Answers (1)
Nupur
on 1 Jul 2023
0 votes
Try the following please:
% Assuming you have eight variables: var1, var2, var3, var4, var5, var6, var7, var8
% Combine the variables into a matrix
combinedMatrix = [var1, var2, var3, var4, var5, var6, var7, var8];
% Alternatively, you can use the horzcat function
% combinedMatrix = horzcat(var1, var2, var3, var4, var5, var6, var7, var8);
% Display the size of the combined matrix
disp(size(combinedMatrix));
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!