MATLAB: How to create a grid from data in a row

columngridMATLABrow

I have got data stored in one row in the columns (24:419). I want to convert this data to a grid with the size 18×22.
Is there any way I could do this?

Best Answer

A = rand(1000) ;
col = 24:419 ; % your columns
row = 7 ; % your row
B = reshape(A(row,col),18,22) ;
pcolor(B)