Input changes in function

Hi,
I have a strange problem, the input in one of my functions changes to 0 on its own.
example: File of function:
function [output]= test (input,N) input N output = size (input); end
Command: N=20; input=[1:8]; [output]= test (input,N)
Output: input=[] N=0 output = 0 0
How is this possible ? It's only one of the functions that acts this way, and even if i change the name or even make a new one with the same content it acts the same.

댓글 수: 1

bym
bym 2011년 3월 31일
Please format your code using the {} button

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

답변 (2개)

Matt Fig
Matt Fig 2011년 3월 31일

1 개 추천

Please go back and format your code! Hightlight your pasted code, then click on the "{} Code" button.
Next, clarify what you mean by "function changes to 0 on its own." How can a function change to zero? What are you talking about?
As far as I can tell, this is your function boiled down to essentials:
function [output]= test(input,N)
output = size(input);
Now calling from the command line it seems nothing is amiss:
>> N=20; input=[1:8]; [output]= test(input,N)
output =
1 8
Walter Roberson
Walter Roberson 2011년 4월 1일

0 개 추천

Do not use "input" as a variable name: MATLAB can and will get it confused with the function of the same name.

카테고리

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

질문:

2011년 3월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by