MATLAB: What does the following expression do

data structures

What data structure does the first line of code create? also what do the second and third lines of code do?
Arr=[];
Arr.N=200;
Arr.R=1

Best Answer

It first creates ‘Arr’ as an empty array, the creates ‘Arr’ as a structure with fields ‘N’ and ‘R’, and assigns values to them.
See the documentation on Create Structure Array (link) and struct (link) for details.
Related Question