More help with getfields and orderfields

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

More help with getfields and orderfields

Rik-4
10/20/14

Can someone try the following under Matlab?

s(2,2).a = 1;
s(1,1).b = 2;
s(:,2).a
getfield (s, {':', 2}, 'a')

AND

s(2,2).a = 1;
s(2,2).b = 2;
s = resize (s, [1 0])
s2 = orderfields (s, {'b', 'a'})
size (s2)

Thanks,
Rik


Reply | Threaded
Open this post in threaded view
|

Re: More help with getfields and orderfields

steph
Results on Matlab2014b and Win7

Steph


On 2014/10/21 00:12, Rik wrote:
10/20/14

Can someone try the following under Matlab?

s(2,2).a = 1;
s(1,1).b = 2;
s(:,2).a
getfield (s, {':', 2}, 'a')
ans =

     []


ans =

     1


ans =

     []


AND

s(2,2).a = 1;
s(2,2).b = 2;
s = resize (s, [1 0])
s2 = orderfields (s, {'b', 'a'})
size (s2)
Undefined function 'resize' for input arguments of type 'struct'.

Error in Untitled (line 3)
s = resize (s, [1 0])
 


Thanks,
Rik


Matlab 2014b on Win7