Assume that the array of cells is initialized with the following structure values.
% Phone book phone_record{1} = struct('name', 'Bob', 'phone', '1233323'); phone_record{2} = struct('name', 'Mike', 'phone', '3245524'); % How to make such or similar one-liner work? % phonebook(:) = phone_record{:} % Expected: % phonebook(1).name = 'Bob'; % phonebook(1).phone= '1233323'; % phonebook(2).name = 'Mike'; % phonebook(2).phone = '3245524';
Is it really possible to accomplish this without using cell2struct or for-loop indexing? Can I use a deal or the like?
Note: if you donโt know the solution, please recommend a โbestโ hint or similar โmanual waveโ.
source share