[scilab-Users] Too many errors 21

Yves Cainaud yves.cainaud at solaronix.com
Thu Apr 1 17:03:51 CEST 2010


Sorry for spoiling the other thread, I have not the same problem.

Whatever I do, I have '!--error 21 Invalid index.'

New figure by scf()? Invalid index
New color map ? Invalid index
Addcolor() ? Invalid index

This problem exist when I run the script by exec(), CMD+L or CMD+E  
from editor, with Scilab 5.2 or Scilab 5.1.1 in MacOSX 10.5.8.
Last week everything was working well and with the same script, I  
don't understand.

The script:

///Users/yves/Scilab/hexapolar_pattern3.txt

//______________________________________
//______________________________________
//field_size in mm
field_size=3000
// radius of the single pattern in mm
radius0 = 1000
//max intensity
//max=4.1/11.4*100 //% of 1000w/sqm
max=53/125.6*100 //for Pe=1150W
// radius of hexapolar pattern in mm
radius = 505 // best central uniformity with 520mm

//______________________________________
//______________________________________

w=winsid() // retrun the list off graphic windows
xdel(w) // delete existinggraphic windows

//xdel(f.figure_id)
//xdel(f1.figure_id)

//M=fscanfMat("/users/yves/Scilab/Mesures_2010-03-25_fit.csv");
M=fscanfMat("/users/yves/Scilab/Mesures_2010-03-25_fit.csv");
M=M*max
f1 = scf();
//Matplot(M)
//f1.color_map = graycolormap(250);
//xs2bmp(f,'/users/yves/normale.bmp');
// radius of hexapolar pattern
m=int(size(M,1));
// radius of the single pattern in mm
radius0 = 1000
pixel_size= 2*radius0/(m-2)

r = int(m/2*radius/radius0);
s= int(cosd(60)*r)
l= int(sind(60)*r)*1 //extended

screen_sizex= 7*r+m+s+7;
screen_sizey=9*l+m;

screen = zeros (screen_sizex, screen_sizey);
i=3.5
centerx=(i-1)*r+1+m
j=3.5
centery=(2*j-1)*l+1
for j = 1:5
	for i = 1:8,
		screen_tmp = zeros (screen_sizex, screen_sizey);
		screen_tmp( (i-1)*r+1:(i-1)*r+m ,  (2*j-1)*l-l+1:(2*j-1)*l-l+m)=M;
		screen=screen+screen_tmp;
	end;
end;

for j = 1:4,
	for i = 1:8,
		screen_tmp = zeros (screen_sizex, screen_sizey);
		screen_tmp( (i-1)*r+1+s:(i-1)*r+m+s ,  (2*j-1)*l+1:(2*j-1)*l+m)=M;
		screen=screen+screen_tmp;
	end;
end;


f1.color_map = jetcolormap(120);
//pM=screen*50; //Matplot(256-pM);
//pM=screen*100/max(screen); Matplot(100-pM);
Matplot(screen);

xrect(1,screen_sizex,screen_sizey,screen_sizex)
hrect=gce() //gets handle on the rectangle
//hrect.foreground=60
hrect.foreground=addcolor(name2rgb('green')/255) //add a new color to  
the colortable and set it to the rectangle line

cornerx=screen_sizex/2+field_size/pixel_size/2+10 //last number is  
optimized by hand
cornery=screen_sizey/2-field_size/pixel_size/2-2
xrect(cornery,cornerx,field_size/pixel_size,field_size/pixel_size)
hrect=gce() //gets handle on the rectangle
//hrect.foreground=60
hrect.foreground=addcolor(name2rgb('green')/255) //add a new color to  
the colortable and set it to the rectangle line
f2=scf(); // new figure -> current
plot2d(screen(:, screen_sizex/4));
plot2d(screen(screen_sizex/4,:));
plot2d(screen(:, screen_sizex/4+l/2));
plot2d(screen(screen_sizex/4+r/2,:));

6*radius
7*sind(60)*radius

f3 = scf(); // new figure -> current
surf(screen_crop);

screen_sizex
screen_sizey

irr=screen(cornery:cornery+field_size/pixel_size,screen_sizex- 
cornerx:screen_sizex-cornerx+field_size/pixel_size)

f4 = scf(); // new figure -> current
f4.color_map = jetcolormap(120);
Matplot(irr);
unif=(maxi(irr)-mini(irr))/(maxi(irr)+mini(irr))*100;
av=mean(irr)
xstring(20,field_size/pixel_size 
+10,strcat(["average=",string(av),"%  /  +/-",string(unif),"%  /   
size=", string(field_size)," mm x ",string(field_size)," mm "]))

Yves




More information about the users mailing list