To store elements with different datatypes from loop

1 Ansicht (letzte 30 Tage)
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 ......

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 18 Apr. 2016
Use cell arrays
M{1}=[1 2 3];
M{2}=5
M{3}='text'
  2 Kommentare
Khaing Zin Htwe
Khaing Zin Htwe am 20 Apr. 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 am 20 Apr. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by