help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting 9s in an integer


From: Rob Mahurin
Subject: Re: detecting 9s in an integer
Date: Fri, 8 Aug 2008 19:05:24 -0400

On Aug 8, 2008, at 6:28 PM, BVBA NuKey Music wrote:
I'm looking for a fast method using octave to detect whether there is
a 9 in an integer (decimal representation)
I need to remove all such integers from a large array filled with integers

i.e. numbers like 19 91 890 should be dropped from the initial array

all help appreciated

It's probably easiest if you use string matching. Your inital array is "z":

octave-3.0.1:54> z = 1:100;
# one number per line
octave-3.0.1:55> sz = num2str(z');
# get row and column index
octave-3.0.1:56> [i,j] = find(sz=="9");
octave-3.0.1:57> z(unique(i)) = []

Cheers,
Rob

--
Rob Mahurin
Dept. of Physics & Astronomy
University of Tennessee         phone: 865 207 2594
Knoxville, TN 37996             email: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]