To store elements with different datatypes from loop

1 vue (au cours des 30 derniers jours)
Khaing Zin Htwe
Khaing Zin Htwe le 18 Avr 2016
Commenté : Khaing Zin Htwe le 20 Avr 2016
Hello my seniors, Could you please help me because I have faced some problems to store elements with different data types.I want to store double array ,structure array that I calculated from loop . How can I store these heterogeneous data types . Thanks all ......

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 18 Avr 2016
Use cell arrays
M{1}=[1 2 3];
M{2}=5
M{3}='text'
  2 commentaires
Khaing Zin Htwe
Khaing Zin Htwe le 20 Avr 2016
Thanks a lot for your kind answer,sir.I wrote that code below,but I got only results for the first iteration,not the second.Why please?Here, Nnodule is 2.
if true
% if Nnodule>=1
for i=1:Nnodule
if Nnodule==1
DetectNodule=Nodule;
else if Nnodule>1
if i==1
DetectNodule=NoduleOne;
else if i==2
DetectNodule=NoduleTwo;
else disp('No');
end
end
else disp('No');
end
end
figure,imshow(DetectNodule);
stats=regionprops(DetectNodule,'Area','ConvexArea','Eccentricity','EquivDiameter','Perimeter','Solidity');
allArea=stats.Area;
ConvexA=stats.ConvexArea;
Eccen=stats.Eccentricity;
Diameter=stats.EquivDiameter;
Perimeter=stats.Perimeter;
soli=stats.Solidity;
Roundness=4*pi*allArea/Perimeter^2; Skew=skewness(DetectNodule); Kur=kurtosis(DetectNodule); Variance=var(DetectNodule); Standard=std(DetectNodule); Smoothness=1-1./(1+uint8(Standard)); end i=i+1; end end
Khaing Zin Htwe
Khaing Zin Htwe le 20 Avr 2016
Thanks , I did it right now,sir. I used the whole image that includes all objects,2 objects here,not used DetectNodule in regionprops .If that line is okay, the later lines are all okay.now i got results for both objects.Thanks sir.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by