place different sets of columns into a matrix
2 views (last 30 days)
Show older comments
Hello all!
I multiple sets of column vectors (with different values) some are a size of 400x5 and others are a size of 400x1 all with different values in their rows. I wish to put all them along each other in one matrix (i.e. to form a matrix of 400x(n5+m1). I don't want any of the individual colmuns to be effected by one another, would just like them to "line up" in one big matrix.
I have tried D = [ A B C D a b c d] (capital are the 400x5, lower case is 401x1) and that is the order I'd like them to line up but it doesn't seem to be working? Any help would be much appreciated!
2 Comments
Rashed Mohammed
on 19 Mar 2021
Hi Tanner,
Unless the 401 in your 2nd paragraph isn't a typo, I would expect what you are doing should work. Can you share what error you are seeing and if possible minimal data to reproduce the issue
Answers (1)
the cyclist
on 19 Mar 2021
As you can see below, what you tried will work.
N = 400;
A = rand(N,5);
B = rand(N,5);
C = rand(N,5);
D = rand(N,5);
a = rand(N,1);
b = rand(N,1);
c = rand(N,1);
d = rand(N,1);
output = [A B C D a b c d];
size(output)
As @Rashed Mohammed mentioned, please tell us the full error message, and upload the data if you can. Also, are all your data numeric? You'll need to use cell arrays or some other data type, if you are mixing numeric and text data.
See Also
Categories
Find more on Logical 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!