Prev: replace values in a cell with nan
Next: Simulink Pulse Generator with amplitude between -1 and +1
From: sean on 10 Feb 2010 20:39 I restarted Matlab and now 'max' works. Thanks all. "sean " <jssweeney(a)widener.edu> wrote in message <hkvmh1$dr4$1(a)fred.mathworks.com>... > EDU>> x=1 > x = > 1 > EDU>> y=2 > y = > 2 > EDU>> c=max(x,y) > ??? Index exceeds matrix dimensions. > > "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hkvm3t$i90$1(a)fred.mathworks.com>... > > Or simply > > > > c = max(x,y)
From: sean on 10 Feb 2010 20:55 Jan, you hit the nail on its head. I did indeed shadow 'max', and that was screwing me up. Thanks to all (although James just made fun of me ;-). "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hkvn3p$k8l$1(a)fred.mathworks.com>... > Dear Sean! > > > EDU>> x=1 > > EDU>> y=2 > > EDU>> max([x y]) > > ??? Index exceeds matrix dimensions. > > You have shadowed the function "max" by a variable which is called "max" also. Solution: > clear max > max(x, y) > It's recommended to avoid using function names a names of variables. > > Kind regards, Jan
From: TideMan on 10 Feb 2010 21:23 On Feb 11, 2:55 pm, "sean " <jsswee...(a)widener.edu> wrote: > Jan, you hit the nail on its head. I did indeed shadow 'max', and that was screwing me up. Thanks to all (although James just made fun of me ;-). > > "Jan Simon" <matlab.THIS_Y...(a)nMINUSsimon.de> wrote in message <hkvn3p$k8....(a)fred.mathworks.com>... > > Dear Sean! > > > > EDU>> x=1 > > > EDU>> y=2 > > > EDU>> max([x y]) > > > ??? Index exceeds matrix dimensions. > > > You have shadowed the function "max" by a variable which is called "max" also. Solution: > > clear max > > max(x, y) > > It's recommended to avoid using function names a names of variables. > > > Kind regards, Jan >(although James just made fun of me ;-). As a top poster, you deserve to be ruthlessly ridiculed. Don't put you reply on top. It makes the thread hard to follow. Put your reply UNDERNEATH
From: James Tursa on 10 Feb 2010 22:23 "sean " <jssweeney(a)widener.edu> wrote in message <hkvo2c$ki7$1(a)fred.mathworks.com>... > Jan, you hit the nail on its head. I did indeed shadow 'max', and that was screwing me up. Thanks to all (although James just made fun of me ;-). Because you didn't show any original work in your first post. I generally don't poke fun at people even for simple questions, but since you didn't show us anything you tried I figured a little good-natured ribbing was not out of line. Looks like you had a genuine issue that you couldn't solve after trying, so I offer my sincere apologies, but I just couldn't resist the opportunity on that one ... James Tursa
First
|
Prev
|
Pages: 1 2 Prev: replace values in a cell with nan Next: Simulink Pulse Generator with amplitude between -1 and +1 |