MATLAB: Access the row and col of a matrix maltlab i have a matrix A = [11 12 1314 15 1617 18 19]; now i take a value 6… how can i get the value there and and row and column…. eg: value = 16row = 2col = 3 Best Answer >> N = 6; % your input>> [col,row] = ind2sub(size(A),N)col = 3row = 2>> val = A(row,col)val = 16 Related SolutionsMATLAB: How to generate a matrix containing 35 rows and 3 columns bsxfun(@power,(-17:17).', 1:3) MATLAB: Extracting the values using [row,col] In the special case that y and z are exactly the same size as x:idx = find(ismembertol(x,xvalues)); corresponding_y = y(idx);corresponding_z = z(idx);In the case that they might not be the same size:[row,col] = find(ismembertol(x,xvalues)); corresponding_y = y( sub2ind(size(y), row, col) );corresponding_z = z( sub2ind(size(z), row, col) ); Related QuestionRandom matrix with maximum values.Matrix Resize Rows and ColsMultiply col vector with matrixFor same Matrix subtraction between rowsMax/Min of nonzero rows/colsAdding to the first value in a matrix based on the second value in that row.XlsColNum2str error
Best Answer