Reputation: 626
I've googled topics about difference between cell array and array and had a vision that cell array actually stores pointers to content of elements.
Operator {}
is like &
in C, right?
When {}
is applied to a variable {var_a,var_b}
, we get a 1*2 "cell pointers" array to var_a
and var_b
? Is there a name for the "cell pointer"?
Does structure array take similar memory arrangement?
Take the example in the matlab document:
patient.name = 'John Doe';
patient.billing = 127.00;
patient.test = [79, 75, 73; 180, 178, 177.5; 172, 170, 169];
patient(2).name = 'Ann Lane';
patient(2).billing = 28.50;
patient(2).test = [68, 70, 68; 118, 118, 119; 172, 170, 169];
so the variable patient is like a 2*3 cell array except the field name?
patientcell{2,3}=...
I was wondering the notion below:
The dot operator in structure makes a deference to its content:
patient(1).test;
=> patientcell{1,3}
right?
Upvotes: 1
Views: 71
Reputation: 688
Preallocation of cell array in matlab
It is reasonable to assume that a cell array is implemented as a continuous array of pointers, each pointing to the actual content of the cell.
How do i define a structure in Matlab
the structure is simply an array of pointer[s]
Upvotes: 1