How do I numeric convert array into string Array?
2 views (last 30 days)
Show older comments
I am trying to make a tidy table to quanitfy segmented data from this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192648/image.png)
I have extracted the information I want using this code:
%%Label items for quantification
mitLabel = bwlabel(Ibin,8)
%Display labeled Items
if true
figure;
subplot(1,2,1), imshow(I), title('Original');
subplot(1,2,2), imshow(label2rgb(mitLabel, 'jet', [.7 .7 .7], 'shuffle')), title('Labeled RGB');
end
%Set parameter
mitStats = regionprops(mitLabel, 'Area', 'Perimeter', 'MajorAxisLength', 'MinorAxisLength')
%Extract arrays for area, perimeter, major axis length and minor axis length for each element in binary image
mitArea = [mitStats.Area];
mitPerimeter = [mitStats.Perimeter];
mitMaxL = [mitStats.MajorAxisLength];
I am planning on presenting this data as following:
Area Perimeter etc.
M1 C1 4 5
M2 C1 10 200
M3 C2 40 40
M4 C2
M5 C3 etc
M6 C4
Mn Cn
Mn Specifies mitochondria number, while Cn specifies which cell the mitochondria is confined in I am making this system because its easier to handle later when I am examining the data (Tidy Data?)
I however need a way for the computer to assign each struct(mitchondria) in the array a number (Mn), but also each cell which is being examined a number. The problem is that every cell contains and unknown number of mitochondrion, so how do I make the Matlab assign each mitochondrion a new variable in the table?
1 Comment
dpb
on 26 Oct 2018
Probably attaching a .mat file with a sample dataset would be easiest for someone else to to work with to try to understand the actual data arrangement...
Storing data as incomplete tables isn't really feasible; you could have a structure array or cell array or maybe even flatten the structure to a table might be the simplest way to organize.
Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!