Problem 86. Renaming a field in a structure array
Solution Stats
Problem Comments
-
2 Comments
Jan
on 27 Feb 2012
Does "All the data still" mean, that the fields are not re-ordered? A lot of the solutions change the order of the fields.
Rafael S.T. Vieira
on 12 Jun 2020
Currently, Matlab has the function renameStructField.
Solution Comments
-
1 Comment
Jason Nicholson
on 6 Jan 2013
When I run the test suite on my computer, this solution works. It passes the test suite.
-
1 Comment
Jan
on 27 Feb 2012
This fails, if the fieldname to be replaced appears as part of another fieldname. Example: S.ab=1; S.a=2; renamefield(S, 'a', 'c')
Problem Recent Solvers1042
Suggested Problems
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
325 Solvers
-
Number of 1s in a binary string
5477 Solvers
-
Create a vector whose elements depend on the previous element
504 Solvers
-
430 Solvers
-
Is this is a Tic Tac Toe X Win?
484 Solvers
More from this Author95
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!