why we use same parenthesis for function calling and array?

조회 수: 5 (최근 30일)
deepak
deepak 2012년 10월 22일
댓글: Manuel Rojas 2020년 8월 8일
a=fun(1,2) is used to call function fun and at the same time we use fun=randi(3,3) a=fun(1,2) to extract 1st row 2nd column of fun
  댓글 수: 1
deepak
deepak 2012년 10월 22일
편집: deepak 2012년 10월 22일
send some other answers in words

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 10월 22일
편집: Andrei Bobrov 2012년 10월 22일
function out = yourfun(a,b)
m = randi(3,3);
out = m(a,b);
end
or
function out = yourfun2(a,b)
global m;
out = m(a,b);
end
% example use function yourfun2
>> global m
>> m = randi(3,3);
>> out = yourfun2(1,2);
  댓글 수: 2
deepak
deepak 2012년 10월 22일
while we using in c we {} for array () for function but in matlab we use same parenthesis why the developer did so
Manuel Rojas
Manuel Rojas 2020년 8월 8일
This is a very big mistake

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by