Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Extracting parts of matrix for sub matrices

조회 수: 1 (최근 30일)
Akila Udage
Akila Udage 2020년 4월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
I have 128 by 128 matrix. I want to extract 16 by 16 matrices from seperately.
it sould be like 1-16 colums with 1-16 rows and then 1-16 columns with 17-32 rows and so on for all 128 by 128 matrix. (using a loop)
i was thinking of a loop to get this done
k=15;
for i = 1:16:128
for j= 1:16:128
newsubMat = myMat(i:i+k,j:j+k);
UnifomityCalc = (max(max(newsubMat)))/(min(min(newsubMat))); % calculation for uniformity
newsubMat_UniformityVector(i,j) = UnifomityCalc; %trying to saving it for 8 by 8 matrix
Can you please help me with this?

답변 (1개)

James Tursa
James Tursa 2020년 4월 6일
E.g., to put them into a cell array
mat = your matrix
result = mat2cell(mat,repmat(16,8,1),repmat(16,8,1));
  댓글 수: 1
Akila Udage
Akila Udage 2020년 4월 6일
편집: Akila Udage 2020년 4월 6일
i was thinking of a loop to get this done
for i = 1:16:128
for j= 1:16:128
newsubMat = myMat(i:i+15,j:j+15);
UnifomityCalc = (max(max(newsubMat)))/(min(min(newsubMat))); % calculation for uniformity
newsubMat_UniformityVector(i,j) = UnifomityCalc; %trying to saving it for 8 by 8 matrix
can you pleas explain this ?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by