Info

この質問は閉じられています。 編集または回答するには再度開いてください。

for each element i of an array , look for a value on a different matrix with value=i

1 回表示 (過去 30 日間)
André Sousa
André Sousa 2014 年 5 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi there! Here is the problem: I have an array a: [1*n] This array contains indices of a reshaped Amatrix I want to use a for cyle( or smt else) to : for each element "i" of that array "a", find using ind2sub, the coordinates correspondent to i and then create a matrix with the same dimentions as matrixA, where the values correspondent to the coordinates found
this what I have(example)
aa=rand(2,2,2);
aareshaped=reshape(aa,[2,4]);
ii=rand(3,1);
irv=zeros(1,size(ind_reshaped));
irv(1,:)=ind_reshaped;
for(ki=(ind_reshaped(1):ind_reshaped(end)))
[R1, C1, S1]=ind2sub(dimention_aa,ind_reshaped)
roi_mat=zeros(dimention_aa);
roi_mat(R1,C1,S1)=1;
end
  1 件のコメント
Sven
Sven 2014 年 5 月 21 日
You're almost there, you've got code and an introduction, just not a question for us to answer.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by