Hi everyone, I want to initialize the same field for several indexes in a structure by some zeros(10,10), and I can't figure out how.
Already took me a while to figure out how to just initialize them to 0:
[test(5:9).field] = deal(0,0,0,0)
Which works but
- I don't want to initialize by a scalar zero but by a 10×10 zeros matrixes
- And obviously I don't want to repeat the
zeros(10,10)
as many times as I have indexes to initialize.
All the options I find are some kind of concatenation functions (for example repmat) which will obviously won't do the job.
There must be an easy an elegant way, but I can't seem to find it :/
Thanks in advance!
P.S.: and obviously, I'm not looking for a loop.
Best Answer