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: subset of dataset
Replies: 3   Last Post: Dec 21, 2012 4:15 AM

Advanced Search

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

Posts: 8,878
Registered: 6/7/07
Re: subset of dataset
Posted: Dec 20, 2012 5:28 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 12/20/2012 1:03 PM, dpb wrote:

>> I can use the following work around, which gives me what I want:
>>>> ages_to_view = [38 39];
>>>> [refs] = find(ismember(hospital.Age,ages_to_view));
>>>> subset_Age3839 = hospital(refs,:)

>> But is there a way to do this as I initially tried it? I don't want to
>> use a 38 | 40, as I may have an awful lots of values to set as criteria.

> ...
> It's what ismember() and friends are for--to reduce the tedium of
> individual conditional statements.

OBTW, probably what you're after that you didn't recognize is to use the
result of the logical operation directly...

ages=(38 39);


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

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.