필터 지우기
필터 지우기

How to write a script

조회 수: 4 (최근 30일)
Riri
Riri 2014년 1월 19일
편집: Riri 2014년 1월 23일
Write a matrix and ask for information

채택된 답변

Amit
Amit 2014년 1월 19일
Something like this?
function myProg
myMat = input('Enter 4x4 Matrix\n');
Useropt = input('Row [1] Column [2] Single Element [3]\n');
switch Useropt
case 1
val = input('Which Row\n');
disp(myMat(val,:));
case 2
val = input('Which Column\n');
disp(myMat(:,val));
case 3
val1 = input('Which Row\n');
val2 = input('Which Column\n');
disp(myMat(val1,val2));
otherwise
disp('wrong input');
end
end

추가 답변 (1개)

Riri
Riri 2014년 1월 19일
편집: Riri 2014년 1월 19일
Yeah I think it would be something like this. I will try it. Thanks a lot
  댓글 수: 1
Amit
Amit 2014년 1월 19일
switch is similar to multiple if-elseif-elseif

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by