Question: How do I select rows of an array?

Hi,

I am just starting with Maple after using Mathcad for nearly 30 years. I want to recreate something I have used a lot in Mathcad: select certain rows in array based on a specified criterion. For example, I want to save just the rows that have a certain value in a certain column and save the new array for use later. I am slowly learning how to do it Maple--for instance, I learned that I need to change the variable printlevel if I want to get the output from nested loops. 

I currently have the following code:

k := 1;

rows := RowDimension(M);


for i to rows do

   if M[i, 3] = "A" then

      row(out, k) := row(M, i);

       k := k + 1;

   end if;

end do;
out;

 

This doesn't seem to work, though. When I try to display out, I just get the name out instead a matrix of values.

I would appreciate it if someone could give me some idea of what I am doing wrong (with Maple, that is).

Thanks,

John
 

Please Wait...