After years of anonymity I've just created my account to ask a question which has been bugging me for a while and I just can't seem to find an answer. I really, really tried! Here it goes:
If you have the matlab structure array:
something(1).toSay = 'qwe';
something(2).toSay = 'asd';
something(3).toSay = 'zxc';
Is there any way to vectorize the reassignment of these 3 entries of the field toSay
?
Like
something = magicFunction(something, [1:3], 'toSay', {'newString1','newString2','newString3'})
final results being:
something(2).toSay >> 'newString2'
I've tried something along with the setfield
function, but couldn't make it work. All I'm trying to do with this question is avoid a for-loop.
Question 2: Would it make a difference if it was a cell array of structures and not a structure array?