copy matrix to struct array

I have a struct array as following:
M(1).x = ones(5,5);
M(2).x = ones(5,5);
M(3).x = ones(5,5);
and a matrix
A = magic(5);
which I would like to copy to all 3 elements of the struct array (replacing the values in the 'x'-field) without using a for loop. How can I do that?
Thank you in advance!

댓글 수: 1

DF
DF 2017년 2월 3일
I think I figured it out: it's function 'deal' I was looking for.

댓글을 달려면 로그인하십시오.

답변 (1개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

제품

질문:

DF
2017년 2월 3일

답변:

2017년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by