I want to add one value at the beginning of a matrix for example, my matrix is
0,0,0,0,0,0
0,1,1,1,0,0
1,0,0,1,0,0
1,1,1,0,0,0
then I want to add ‘1’ or ‘0’ at the first column therefore it will become like this
1,0,0,0,0,0,0
1,0,1,1,1,0,0
1,1,0,0,1,0,0
1,1,1,1,0,0,0
0,0,0,0,0,0,0
0,0,1,1,1,0,0
0,1,0,0,1,0,0
0,1,1,1,0,0,0
how can I do that in MATLAB?
You can concatenate matrices without creating another one from scratch like this:
Documentation about concatenating matrices:
These two documentation pages describe in details the existing methods that let you concatenate arrays horizontally (what I did in the example above) and vertically (if you wanted to add lines to your matrix).