Clear Filters
Clear Filters

array initialization

4 views (last 30 days)
x
x on 2 Oct 2011
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

Answers (1)

Walter Roberson
Walter Roberson on 2 Oct 2011
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.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!