Prev: using the sortrows function
Next: 2D string matrix?
From: Fernando Yuji Ono on 11 Jul 2010 21:23 Consider this simple function: function [x] = rand(y) x = 2*y; I noticed that I can't use x directly outside the function, like this: output = x; So how do I do that? Message was edited by: Fernando Yuji Ono
From: Walter Roberson on 12 Jul 2010 01:44 Fernando Yuji Ono wrote: > Consider this simple function: > > function [x] = rand(y) > x = 2*y; > > I noticed that I can't use x directly outside the function, like this: > > output = x; > > So how do I do that? That isn't possible in Matlab for function variables that are declared as input or output parameters.
From: TideMan on 12 Jul 2010 02:31 On Jul 12, 5:23 pm, Fernando Yuji Ono <fernando90...(a)gmail.com> wrote: > Consider this simple function: > > function [x] = rand(y) > x = 2*y; > > I noticed that I can't use x directly outside the function, like this: > > output = x; > > So how do I do that? > > Message was edited by: Fernando Yuji Ono What you're doing is silly. rand is an in-built function. You should use a different name. function x=twice(y) x=2*y; y=2; output=twice(y)
From: Fernando Yuji Ono on 11 Jul 2010 23:53 Thanks for your answers. It worked.
|
Pages: 1 Prev: using the sortrows function Next: 2D string matrix? |