So i have a structure called data
looks like this
data. gender = 'female'
. age = '25'
.reproductiontime = 100x2 double
I would like to extract the values from age and gender from all my data which is around 200 files and they're all in the same format add a value to gender such as female = 1, male=2 non-binary=0
Can I assign values to gender structure or a sub-structure perhaps?
And do I just put this in the output of my function then? As in function [age, gender] = m(data) ?
Thanks in advance,
sorry if horribly basic but I feel like i'm ovecomplicating it and there might be a quick and easy answer I am not seeing.
2 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/493297-how-to-extract-values-from-structure-as-array-and-assign-numeric-values-to-them#comment_771631
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/493297-how-to-extract-values-from-structure-as-array-and-assign-numeric-values-to-them#comment_771631
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/493297-how-to-extract-values-from-structure-as-array-and-assign-numeric-values-to-them#comment_771671
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/493297-how-to-extract-values-from-structure-as-array-and-assign-numeric-values-to-them#comment_771671
Sign in to comment.