Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Bug or Feature in find()?
Replies: 1   Last Post: Dec 9, 1996 12:28 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
James Michael Hammond

Posts: 3
Registered: 12/7/04
Bug or Feature in find()?
Posted: Dec 7, 1996 11:40 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm using MATLAB 4.2c dated Dec 31 1994 on a SunOS 4.x machine.

If I use find with zero (or one) output parameter(s) on a full
vector, the answer will be in the same row-or-column orientation as
the input:

>> a = rand(4);
>> find(a(1,:))


ans =

1 2 3 4

>> find(a(:,1))

ans =

1
2
3
4

but if I use it on a sparse row or column vector, the answer will
always be a column vector:

>> a = sparse(a);
>> find(a(1,:))


ans =

1
2
3
4

>> find(a(:,1))

ans =

1
2
3
4

This not only cost me a small but annoying amount of time trying to
figure out why my nifty slick "pull out the innermost loop with
vectorization" trick was failing, but also cost the MathWorks a
little bit of free advertising, as the professor who was watching me
try to prove how much easier it is to code numerical stuff in MATLAB
than in C remained unimpressed.

--JMike
-------------------------------------------
J Michael Hammond <hammond@cs.utk.edu> |
Univ of Tenn Dept of Comp Sci |
http://www.cs.utk.edu/~hammond/jmike.html |






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.