two outputs of a function
조회 수: 7 (최근 30일)
이전 댓글 표시
function [cnt,A] = matrice_nou_vechi(A,noua,veche)
cnt=0;
for row=1:size(A,1)
for col=1:size(A,2)
if(A(row, col)==veche)
A(row,col)=noua;
cnt=cnt+1;
end
end
end
how can i see both "cnt" and matrix "A" when a call the function in command window? (without using disp function)
댓글 수: 0
채택된 답변
Stephen23
2020년 11월 13일
[cnt,A] = matrice_nou_vechi([1,2],3,2)
댓글 수: 2
Stephen23
2020년 11월 13일
편집: Stephen23
2020년 11월 13일
Yes.
It isn't very secret though: https://www.mathworks.com/help/matlab/getting-started-with-matlab.html
추가 답변 (1개)
Steven Lord
2020년 11월 13일
Your function is defined to return two output arguments. Now you have to call it with two output arguments. I'm assuming you have created variables for the three inputs aready, I'll call them A, x2, and third.
[output1, secondOutput] = matrice_nou_vechi(A, x2, third);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!