How to add a field to a matlab struct.

3 views (last 30 days)
Daniel Boateng
Daniel Boateng on 15 Mar 2019
Commented: madhan ravi on 15 Mar 2019
I have a matlab function that takes a struct array in my workspace as an input.The struct has fields a and b. I want to add another field c in the struct. Please how fdo I do this.

Answers (1)

madhan ravi
madhan ravi on 15 Mar 2019
yourstruct.c=...;
% doc setfield()
  7 Comments
Daniel Boateng
Daniel Boateng on 15 Mar 2019
Thanks bro. It works perfectly
madhan ravi
madhan ravi on 15 Mar 2019
Thank you Guillaume for the explanation.

Sign in to comment.

Categories

Find more on Structures in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!