[scilab-Users] Problem with loop

Celso Co celso.co at gmail.com
Fri Oct 1 04:15:44 CEST 2010


Dear Marcin,

I cannot make such loop since there are still missing informations.

Base on your discussion, I see that your inputs are b and A and your
output is modified A.
Then you reused your modified A with the same function until A=[].

My suggestionn is to copy your A matrix into say B matrix. Then work
on your B. Then for the next loop, copy A again on B and work on the B
matrix. and so on.  In other words, your input is A and your output is
B.  Don't change the input A as you reuse it in your loop.

You may be deleting rows of A to serve as your exit index in "do" or
"while" loop. However, using "for" loop the index nos is given and you
do not need to delete rows.

Attached file contains some example of matrix manipulation.

Regards,
celso

2010/9/30 marcin.wozniczka Gazeta.pl <marcin.wozniczka at gazeta.pl>:
> Ok, so I'll try to explian and describe (in general) how my program is
> working and what exactly it should count.
> I have matrix 'A' and vector 'b'.
> A = [10     5    2   56.1385
>          2   10    5    61.8331
>          5   10  17    46.2755
>        10   17    5    70.5242
>          5   17   30   66.5410
>        30    5   17    86.5961] - Numbers in columns 1-3 are numbers of
> points which define angle in triangle (First column is left point in angle,
> second is center and third is rigth).
> b = [10 2] - points which coordinates are known.
> So, next I have several function (general loops), which are taking from
> matrix 'A' data (4 column) using data in vector 'b'. When data is taking
> from matrix 'A' they are automatically deleted in this matrix, and the new
> number is added to vector 'b'. In this example in matrix will be deleted
> lines 1 & 2 and to vector will be added number 5. This function I have
> defined and they are working correctly.
> And the problem which I have is to create loop or function which will repeat
> all loops and function until the matrix A will be empty (A=[]).
> Do you know how to create this loop?
> --
> Marcin Woźniczka
>



-- 
Eng'r Celso B. Co, PhD ECE
Assistant Professor
Dept. of Electronics, Computer, and Communication Engineering,
Loyola Schools of Science and Engineering, Ateneo De Manila
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Marcin.sce
Type: application/octet-stream
Size: 705 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20100930/254d60c4/attachment.obj>


More information about the users mailing list