I have a dem data(an image of 6000X5200). I need to convert the data and create a 3XN matrix with row number, coloum number and Z value (pixel value of the image represent the Z value).
orgim = imread('dem'); % read DEM data
nentry = 0; for ii = 1:size(orgim,2) for jj = 1:size(orgim,1) nentry = nentry +1; mydata(nentry, :) = [ii, jj, orgim(jj,ii)]; clear X Y Z; end end
This works but takes time. Is there any optimum way to convert the multi-dimentional 6000X 5200 matrix as 3XN matrix, without loop
Best Answer