How do I rename a field in a structure array in MATLAB?

Posted by Matthew Simoneau on Stack Overflow See other posts from Stack Overflow or by Matthew Simoneau
Published on 2010-04-28T22:35:51Z Indexed on 2010/04/28 22:37 UTC
Read the original article Hit count: 298

Filed under:

Given a structure array, how do I rename a field? For example, given the following, how do I change "bar" to "baz".

clear
a(1).foo = 1;
a(1).bar = 'one';
a(2).foo = 2;
a(2).bar = 'two';
a(3).foo = 3;
a(3).bar = 'three';
disp(a)

What is the best method, where "best" is a balance of performance, clarity, and generality?

© Stack Overflow or respective owner

Related posts about matlab