[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug compatibility ;-)
From: |
Daniel Heiserer |
Subject: |
bug compatibility ;-) |
Date: |
Tue, 23 Mar 1999 08:08:13 +0100 |
Hi,
I have a request for another bug compatibility of matlab. (if you want
to see it like this)
octave:1> a=rand(4)
a =
9.0658e-05 9.8327e-01 7.0094e-01 2.4211e-01
6.4865e-01 7.2977e-01 3.5448e-01 6.4133e-01
4.1370e-01 5.2723e-01 4.1625e-01 7.1674e-01
7.9464e-01 9.0385e-02 3.8075e-01 4.3088e-01
octave:2>
octave:2> a(:)
error: single index only valid for row or column vector
error: evaluating index expression near line 2, column 1
The thing is that I want to filter some data in a matrix using find
and reassign new values than. Unfortunately I don't know how to do
that in octave.
example:
a=rand(4,4);
b=find(a<0.3);
c=find(a>0.7);
a(b)=0;
a(c)=1;
In matlab that kind of stuff works, because matlab allows
single-indexing of multiindexed variables.
assignments like a=rand(4);b=a(:); work.
Maybe there is a "cleaner" way, but matlab's 'quick and dirty'
approach works quite fine.
Thanks daniel
- bug compatibility ;-),
Daniel Heiserer <=