To join two different sizes of vectors to a table in MATLAB, you can use the table()
function along with padarray()
.
First, use padarray()
to add NaN values to the shorter vector so that both vectors have the same length. Then, use table()
to create a table with both vectors as columns. Here is an example:
main.m388 chars14 lines
This will create a table T
with the following content:
| Column1 | Column2 | |---------|---------| | 1 | 4 | | 2 | 5 | | 3 | NaN |
gistlibby LogSnag