필터 지우기
필터 지우기

Looping for set Indices only

조회 수: 6 (최근 30일)
Ferd
Ferd 2012년 6월 11일
Hi,
I have an arrays that is slightly off the my predicted values after calculations and would like to investigate those iterations. The two arrays are basically indices from the loop. I identified those itearations as an array. Now, I would like to use just those indices in another loop to calculate further.
LowRPMIndex = [16;31;46;60;75;90;105;119;130;144;145;146];
for y= 1:length(LowRPMIndex)
PositiveO2(y)= find(O2(:,LowRPMIndex)>0);
end
I would like the "y" to be the Index value value while it loops until the length of the LowRPMIndex.
Thanks
  댓글 수: 2
Ryan
Ryan 2012년 6월 11일
So you are trying to populate a vector Positive02 that is strictly the positive values of all rows and the LowRPMIndex columns of O2?
Ferd
Ferd 2012년 6월 11일
Yes, indeed!

댓글을 달려면 로그인하십시오.

채택된 답변

bym
bym 2012년 6월 11일
O2 = randi([-5,10],150); %Create sample data
subO2 =O2(:,LowRPMIndex); % pull out all rows of LowRPMIndex columns
PositiveO2 = subO2(subO2>0); % get positive values
  댓글 수: 1
Ferd
Ferd 2012년 6월 12일
or without the loop...:) kewl thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by