separating matrices and performing operation
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a code
A is a matrix
n = numel(A);
A1_30 = repmat(A,[1,1,30]);
t = ones(size(A));
for j1 = 1:size(A1_30,3)
p = t;
p(randi(n,15000,1)) = 0;
A1_30(:,:,j1) = A1_30(:,:,j1).*p;
end
A1_30 has 30 matrices,now for first 10 matrices ,i want to do some operation,next 10 another operation and last 10 anoher operation,please tell how to process these in a for loop
[Merged information from duplicate question]
I have a code
A=rand(256,256)
n = numel(A);
A1_30 = repmat(A,[1,1,30]);
t = ones(size(A));
for j1 = 1:size(A1_30,3)
p = t;
p(randi(n,15000,1)) = 0;
A1_30(:,:,j1) = A1_30(:,:,j1).*p;
end
no i want to separate these matrices int 3 parts,into 10 each for performing different operation
i need first 10 matrices in separate loop ,second in another for loop ,another 10 in another for loop,
please help
for example
for the 10 imatrix i want to convert them into bw,
for next 10;i want to resize to 128x128;PLEASE HELP,FOR next 10 another operation,please say for one operation
댓글 수: 3
Walter Roberson
2012년 5월 24일
Removing any information in your (now merged) question that is no longer relevant would help make the question easier to understand.
People answer when they feel like answering. There are no promises of answers here. It is just after midnight in most of North America, so the North Americans are mostly in bed (which is where I will be in a few short minutes.) It is roughly 6:30 in the morning in western Europe, so the volunteers there are mostly still sleeping. You can pretty much expect another 2 to 3 hours before any of the other regular volunteers reads your question; whether they will respond at all is up to them.
If you need a response more quickly than "Sometime after morning coffee, or a few days after that perhaps", then it is recommended that you hire a consultant.
And now it is time for me to rest my aching fingers.
답변 (1개)
the cyclist
2012년 5월 23일
One possible way:
A1_30 = rand(5,5,30);
for nk = 1:3
indexToThisThird = 10*(nk-1) + (1:10);
A1_30(:,:,indexToThisThird) = nk; % Replace this line with whatever you want to do
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!