I have these below codes:
a(1).x = 3;
a(2).x = 1;
a(3).x = -5;
a(4).x = 2;
b = [0 0];
b = a(1:2).x
======================
output => b = 3
I want variable b be equal to [3 1] but variable b is 3.
(Note: "[b(1) b(2)] = a(1:2).x" is not Suitable Answer for me Because for bigger array this solution is overwhelming)
Please Help me.
Thanks

 채택된 답변

per isakson
per isakson 2015년 6월 9일

1 개 추천

Try
>> b = [a(1:2).x]
b =
3 1

댓글 수: 1

ar fa
ar fa 2015년 6월 9일
Excellent per Isakson
Thank you very much.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

질문:

2015년 6월 9일

댓글:

2015년 6월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by