MATLAB: How to select certain elements from a matrix matricesmatrix array A=[1,2,3,4], B=[90,0,40,0;0,0,10,60;55,15,0,10;0,15,5,0] Hi everyone.. I want to select indexes of only one zero from each row and respective column. please help me in writing matlab code for this problem. Thanks in Advance Best Answer B=[90,0,40,0; 0,0,10,60; 55,15,0,10; 0,15,5,0];[col row]=find(B==0);A= [row col] % coordinates of your zero-elementsA = 1 2 1 4 2 1 2 2 3 3 4 1 4 4 Related SolutionsMATLAB: How to change this matrix in this manner H = [reshape(reshape(A(:,1:2),[],2)',[],1);reshape(reshape(A(:,3:4),[],2)',[],1)]; MATLAB: How to insert rows and colums of zeroes in this matrix ??? a=[1 2 3;4 5 6] Here is one quick way to interlace columns and rows of zeros:>> a=[1 2 3;4 5 6];>> b = zeros(2*size(a));>> b(1:2:end,1:2:end) = ab = 1 0 2 0 3 0 0 0 0 0 0 0 4 0 5 0 6 0 0 0 0 0 0 0 Related QuestionFinding coordinates or locations in matrixSorting array with condition (paths sorting)Reading multiple columns of an excel sheet to output a range of values. Please see the exampleAssigning values from one array to another if certain specifications are met.
Best Answer