Question: plotsetup and if statements

 

Hello

I have Problem with the Maple command plotsetup, it does not seem to work within an if-statement.

What i would like to do is this:

1. Make a matrix with 0 or 1 as enteries

2. convert this matrix into a list where the 1's are points. (So the Matrix entery Matrix[1][1]:=1 would give the listvector:=[1,1]

3. plot these vectors as graphs and store them with the help of plotsetup

4. changing the matrix and rinse and repet 2,3,4 until satisfied

 i had no trouble programing point 2 and 4 but somehow plotsetup does not work within an if statement is there any workaround

to give you a better overview of what i would like to do i will post a much simplified version of  my programm bellow. 

 

edit:i forgot to mention that without the if statement, which is needed, the programm works fine 

 

[Spoiler]

plottingmyarray := proc (Arrayfield, Length1, nr)
local counter1, index1, index2, Liste, fname, Nullerstring, index3; 
counter1 := true; 
index1 := 1; 
index2 := 1; 
Liste := []; 
fname := NULL; 
Nullerstring := "0"; 
index3 := 1:

with(plots); 
with(StringTools); 


for index1 to Length1 do
  for index2 to Length1 do
    if Arrayfield[index1, index2] = 1 and counter1 = true then
     Liste := [index1, index2];
     counter1 := false
   elif Arrayfield[index1, index2] = 1 and counter1 = false then
     Liste := Liste, [index1, index2]
   end if
 end do
end do;


Liste := [Liste]; 
 
for index3 to 6-length(nr) do
 Nullerstring := cat(Nullerstring, "0")
end do; 
 
fname := cat("Brownian_Plot_", Nullerstring, nr); 
plotsetup(gif, plotoutput = fname); 
plot(Liste, style = POINT, view = [1 .. Length1, 1 .. Length1]); 
 
return plot(Liste, style = POINT, view = [1 .. Length1, 1 .. Length1]);

end proc:


>Second break

local L := 3:  

Full := Array(1 .. L, 1 .. L, datatype = integer):
 counter2 := 4: 
 Full[2, 2] := 1: 
 Full[2, 3] := 1: 
 
 
for awwww to 10 do
  if counter2 = 4 then
   plottingmyarray(Full,L,awwww);
   print(counter2): 
 end if: 
end do:

[/Spoiler]

Please Wait...