TIB: RE: searching matrixes


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

TIB: RE: searching matrixes



Use a pair of for loops

 

Dim([A])\->\L1

L1(1)\->\a

L1(2)\->\b

For(c,1,a)

For(d,1,b)

If [a](a,b)=2

Then

Whatever

End

End

 

 

The reason I stored the diminutions of the matrix in variables is that the dim() command is slow and you don’t want to have to do it each time around the loop.

 

____________________

I came, I saw, I replied

 

-----Original Message-----
From: owner-ti-basic@lists.ticalc.org [mailto:owner-ti-basic@lists.ticalc.org]On Behalf Of Bruce Hilman
Sent: Tuesday, September 26, 2000 4:56 PM
To: ti-basic@lists.ticalc.org
Subject: TIB: searching matrixes

 

is there a way to search a matrix to find a number in any row or column without having to look at each individual row and column

eg

[[1 2]

 [3 4]]

if [a](1,1) = 2

then

whatever

if [a](1,2) = 2

then

whatever

if [a](2,1) = 2

then

whatever

if [a](2,2) = 2

then

whatever

instead of this something that does searches the matrix in one command

 


Follow-Ups: References: