I have struct and array of structs in matlab like:
s.name = 'pop';
s.val1 = 2.3;
s.val2 = 4.3;
q = repmat( s, 5, 5 );
Is it possible to do operations in vectorial-way?
%// Something like this?
q(:,:).val1 = q(:,:).val1 + q(:,:).val2 * 0.2;
Upd:
Thanks for replies. Actually, I was asking about "simple" (with meaning "vectorial-way"). Now I see it's impossible using structures. So the only way is to use something like arrayfun suggested by DreamBig. Or use structure of arrays.
temp = arrayfun(@(x, y) plus(x, y), [q.val1], [q.val2]*0.2, 'UniformOutput', false);and then assigning it as[q.val1] = deal(temp{:})- DreamBigdeal... very nice. - rayryeng