hi let's assume i have the following in matlab
h = [0,0,0,1;
1,1,1,1];
now how can i print all the values of the first subarray, i.e. 0,0,0,1
or for example the second subarray 1,1,1,1. thanks !
hi let's assume i have the following in matlab
h = [0,0,0,1;
1,1,1,1];
now how can i print all the values of the first subarray, i.e. 0,0,0,1
or for example the second subarray 1,1,1,1. thanks !
You can access just the first row of your matrix by doing
firstRow = h(1,:)
Similarly, you could access just the third column by
thirdColumn = h(:,3)
I suggest you look into the MATLAB help under "Matrix Indexing" as this is really basic stuff (and there's a lot of other nifty things you can do to access a subset of a matrix)
For printing, you can omit the final ;
, or look into functions display
and fprintf
.