Is there a built-in function to concatenate arrays in the third direction?
6 views (last 30 days)
Show older comments
Bruce Elliott
on 5 Jan 2024
Commented: Bruce Elliott
on 5 Jan 2024
Is there an equivalent function to vertcat(..) and horzcat(..) but in the direction of a third index, e.g. pagecat(..)?
I always accomplish this by horizontally concatenating my arrays and then using permute(..), but it would be convenient to be able to do it with a single function call. Better still, add a third operator to "," and ";" as a shortcut to a pagecat(..) function, if there are any symbols left for that purpose.
0 Comments
Accepted Answer
John D'Errico
on 5 Jan 2024
Edited: John D'Errico
on 5 Jan 2024
Logically, one would just use cat. How might you have found this? READ THE HELP!
That is, near the end of the help for all MATLAB functions, they try to list functions which have similar abilities, are related in some way. That will be a see also line.
help horzcat
In the help for hirzcat, for example, you see the line,
See also vertcat, cat.
And while you know what vertcat does, what might cat do?
help cat
Try it out.
A = magic(3);
B = eye(3);
C = cat(3,A,B)
5 Comments
Dyuman Joshi
on 5 Jan 2024
Some cats are like voids, you can only find them if they stare back at you.
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices 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!