Given some data - for example (in my case) - like the following tabular
Name |pos_x|pos_y|pos_z
------------------------
Point1| .1| .1| .2
Point2| 0.0| 0.0| .1
Middle| .1| .2| .1
Point3| 0.0| 1| 0.0
and maybe after importing that data from excel all values are stored in a cell array (lets call it celldata).
For testing purposes this cell could be created with the line
celldata={'Point1' .1 .1 .2;'Point2' 0 0 .1;'Middle' .1 .2 .1;'Point3' 0 1 0}
For this example the cell is of size 4x4.
At the moment I'm creating a structure with the following lines
point.name=char(celldata(:,1));
point.posxyz=cell2mat(celldata(:,2:4));
This results in point size 1x1 Class struct. I'm looking for an efficient way to generate it as point size 4x1 Class struct - thus one element for each line in the tabular above - all with the same inner structure: a name and the coordinates.
I already tried cell2struct, but that is only able to unfold along one dimension without grouping some colums together - as far as I tried.
Further, this is not a duplicate of Preallocate structure of cells in matlab as in this case here, I have many different columns - or maybe even a dynamic count of columns.
datasetwould be any helpful?for punkt=point,disp([punkt.name ':' num2str(norm(punkt.posxyz))]),endas an example. Especially one does not need to check how many elements there are. Do you know anything better?