a=[2016;2016;2016;2016;2016;]; (5x1 double)
b=[06;06;06;06;06;]; (5x1 double)
From
c= ([a,b]); (5x2 double)
When you run the
But
c(:, (-2,-1))= nan;
If you do
,
'The index at position 2 is not valid. Array indexes must be positive integers or logical values.'
That's what it says.
What I'm curious about is that I want to add a new column to the front of the first row, for example
Isn't there a function or expression that we insert into the front of the first row? Do I have to create a new matrix 5x4 matrix and hang it out?
matlab
Please refer to the code below.
a=2016*ones(5,1);
b=6*ones(5,1);
c=[a b];
c=[nan*ones(5,2) c];
© 2025 OneMinuteCode. All rights reserved.