array initialization

4 次查看(过去 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 中查找有关 Polygons 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by