MATLAB: Referring to multiple columns columncolumnsmatricesmatrix Hi, mat = 7 8 9 10 12 10 8 6 How can I refer to the first two columns of the matrix above? Thanks in advance. Best Answer Ahmet - if mat is your matrix, then to get the first two colums (and all rows) you could do mat(:,1:2)which would give you 7 8 12 10Note how the first colon indicates that we want all rows, and the 1:2 means that we want the columns one through two. Related SolutionsMATLAB: Hello,How ı should chose desired columns in a row in matrix?Thanks out = A(:,2:5) MATLAB: Copy matrix column with refer to secondary column. A = [1,2,3,0; 4,5,6,0; 7,8,9,0];B = [4,5,6,3];A(ismember(A(:,1:end-1),B(1:end-1),'rows'),end) = B(end); Related QuestionColumn and row rearrangementHow to refer to multiple separate columnsHow sort rows of matrix as per given indexHow to swap columns of a matrix?How can i find column refer to rowDelete rows from matrixWhat does this refers to
Best Answer