I got an .mat file with a variable X
:
>> open('3rdPartyInputfile.mat')
>> X
X =
0x0 struct array with fields:
a
b
I tried to create a similar variable like:
>> X1(1).a = [];
>> X1(1).b = [];
>> X1(1)=[]
X1 =
1x0 struct array with fields:
a
b
>> X2(1).a = [];
>> X2(1).b = [];
>> X2(:,:)=[]
X2 =
0x1 struct array with fields:
a
b
Which is close but not identical. The size here are 1x0 or 0x1, instead of the desired 0x0.
How to get it to 0x0?
To get a 0x0 struct you can use
X = struct('a',{},'b',{})
In case you have an existing struct x
and want to scale it down to 0x0, you could do the following:
y=repmat(x,0,0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With