Assume there is a cell array initialized with the following struct 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 indeed possible to accomplish this w/o using cell2struct or for-loop indexing?
Can one use deal or similar?
Note: if you don’t know the solution please spare the “best-practice” hinting or similar “hand-waving”.
You can use
cell2mat: