SMath Studio Forum
»
SMath Studio
»
Questions
»
How does the equality operator work?
Rank: Newbie
Groups: Registered
Joined: 16/06/2012(UTC) Posts: 7 Location: Home Counties
|
Hello,
How is the equality (ctl-=) operator supposed to work? I get ([1]=1)=1 but ([1])=2; the latter I expect, but I am surprised that a matrix is equal to a scalar, even though it is just a single element matrix.
Is there a way of programmatically distinguishing between a scalar and an array? I know there's no IsScalar or IsArray function. I've seen the workaround for using num2str & mat and I've written a function
IsArray(x):= |n:=findstr(num2str(x),"mat" ) |n<>-1
(why doesn't IsArray(x):=findstr(num2str(x),"mat" )<>-1 work?)
, but this would appear to impose quite an evaluation overhead for large matrices. I was hoping to use x=stack(x) to check if x was an array, hence the purpose of my original question.
Stuart
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
How does the equality operator work?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.