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 Kommentar

bym
bym am 31 Mär. 2011
Please format your code using the {} button

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Matt Fig
Matt Fig am 31 Mär. 2011

1 Stimme

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 am 1 Apr. 2011

0 Stimmen

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

Kategorien

Mehr zu Software Development finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 31 Mär. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by