Error using ==> disp and Error in ==> TempArray1 at 6 disp('New B is equal to',D);
조회 수: 1 (최근 30일)
이전 댓글 표시
I wrote two simple m files as follow trying to overwrite the values of B by the values of A. In other words, my intention is to ultimately have B as [1 2 3 4] by rewriting the matrix A to B. The reason that I have utilized two m file is that later on I need to implement such system to another problem in which the main m file has to be run with modified values of B in each step of loop. First m file as: disp('A is [1 2 3 4]'); disp('B is [4 3 2 1]'); A=[1 2 3 4]; B=[4 3 2 1]; D=TempArray2(A,B); disp('New B is equal to',D); Second m files as: function D=TempArray2(s1,s2) s2=s1; D=s2; But I again got another error message as : ??? Error using ==> disp Too many input arguments.
Error in ==> TempArray1 at 6 disp('New B is equal to',D);
Do u know the solution to this problem?
댓글 수: 0
답변 (1개)
Fangjun Jiang
2011년 9월 10일
disp() is used to quickly display a text or array. You can't combine two together. In your example, use:
disp('New B is equal to');
disp(D);
or use fprintf
fprintf('New B is equal to %f%f%f\n',D);
참고 항목
카테고리
Help Center 및 File Exchange에서 Communications Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!