MATLAB: How to add element to a cell array struct without loop

cell arrays structurewithout loop.

Hi, I have a cell array, each of them is a structure, I want to add values in all arrays with field name myfield, how I do it without a loop?
for i = 1:10
C{i}.myfield = 1;
end
I can not use
C{1:10}.myfield = 1;
because it has the error:Expected one output from a curly brace or dot indexing expression, but there were 10 results. Maybe is there another simple method?
Thanks forward

Best Answer

This would be trivially easy if you had stored your data in a non-scalar structure (instead of inefficiently in lots of separate structures in a cell array):
>> [S(1:10).data] = deal(1)
S =
1x10 struct array with fields:
data
>> S(1).data
ans =
1
>> S(6).data
ans =
1