why we use same parenthesis for function calling and array?

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

while we using in c we {} for array () for function but in matlab we use same parenthesis why the developer did so
This is a very big mistake

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2012년 10월 22일

댓글:

2020년 8월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by