MATLAB: Too many output arguments

조회 수: 4 (최근 30일)
Leonard
Leonard 2014년 10월 3일
댓글: Leonard 2014년 10월 3일
I'm fairly new to MATLAB but it seems to me that the following line should be correct:
[x,y,z] = [1,2,3]
Why am I getting a "Too many output arguments." error?
x,y,z are unused variables and I've even declared them each as zeros(1).
Thanks!

채택된 답변

Image Analyst
Image Analyst 2014년 10월 3일
[1,2,3] is an expression that produces a single thing : an array. You are trying to assign the single thing to 3 separate things . That's the explanation. If you want fix, use deal or assign the 3 variables separately in 3 separate lines.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 10월 3일

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by