필터 지우기
필터 지우기

array initialization

조회 수: 5 (최근 30일)
x
x 2011년 10월 2일
in my code i am taking 125 patches and for each patch i am getting 6 values as output of my process.. i am in need to place the 1st value of al the 125 patches in a single array ,2nd value of al 125 patches in another array ...so on upto 6 values..help me in this

답변 (1개)

Walter Roberson
Walter Roberson 2011년 10월 2일
numpatches = 125;
valsperpatch = 6;
pvalues = zeros(numpatches,valsperpatch);
for K = 1 : numpatches
....
thesepvals = ... %the 6 outputs of processing patch #K
pvalues(K,:) = thesepvals;
end
pval1 = pvalues(:,1);
pval2 = pvalues(:,2);
pval3 = pvalues(:,3);
pval4 = pvalues(:,4);
pval5 = pvalues(:,5);
pval6 = pvalues(:,6);
You should consider, though, whether you really need them to be in separate variables; perhaps you should just leave them in the pvalues array.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by