# Script error

4 messages
Open this post in threaded view
|

## Script error

 Dear all,I'm new user of octave and I need an help with this script.%script per definizione passo fori lamierad=6; %Diametro dei forip=15; %Passo (da iterare)p1=p*cos(pi/3); %Passo in direzione assiale (affinchè il pattern sia triangolare equilatero)r2=622.5; % Diametro Max conor1=36; % Diametro Min conoL=2610; % Lunghezza Lamieraalpha=atan((r2-r1)/L); %Angolo di semiapertura Cono rm=(r2+r1)/2; %Raggio medio conoS=2*pi*rm*L; %Superficie LamieraSforata=0.362*S; %Superficie forataNfori=Sforata/(pi*d^2/4); %Numero di forin=(L-2*p1)/p1+1; r(1)=r2-p1*tan(alpha);for i=1:n r(i+1) = r(i) - p1*tan(alpha); f(i) = 2*pi*r(i)/p;end When I run it I receive this message:error: r(347): subscripts must be either integers 1 to (2^31)-1 or logicalserror: called from    pattern at line 17 column 10But I however obtain series number.How can I solve this problem? Where I'm wrong?Best regards_______________Stefano MilaniStructural Design SpecialistEner Consulting S.r.l.
Open this post in threaded view
|

## Re: Script error

 On Sun, Mar 18, 2018 at 8:08 AM, Stefano Milani wrote: n=(L-2*p1)/p1+1; ​n is double​ r(1)=r2-p1*tan(alpha);for i=1:n r(i+1) = r(i) - p1*tan(alpha); f(i) = 2*pi*r(i)/p;end When I run it I receive this message:error: r(347): subscripts must be either integers 1 to (2^31)-1 or logicalserror: called from    pattern at line 17 column 10But I however obtain series number.How can I solve this problem? Where I'm wrong?​n is double, but it "​must be either integers 1 to (2^31)-1 or logicals"You can do something like n=int32((L-2*p1)/p1+1);Best regards_______________Stefano MilaniStructural Design SpecialistEner Consulting S.r.l. ​Dmitri.-- ​