Assiging indexed values to a structure field

1 次查看(过去 30 天)
I would like a field of my indexed structure to take on a value similarly indexed in a different vector:
struc(1:3).value=1:3
However, this gives the error "Expected one output from a curly brace or dot indexing expression, but there were 2 results."
Enclosing either the left- or the right-hand side of the assignment line in square brackets does not help.
How can I achieve this variable assignment, other than by using a for loop?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by