help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax "if"


From: Doug Stewart
Subject: Re: syntax "if"
Date: Tue, 18 Jun 2019 12:26:09 -0400



On Tue, Jun 18, 2019 at 12:12 PM FelipeLyra <address@hidden> wrote:
I'm trying to make a simple code using "if" :

clear;
clc

dia = input('Day: ');
printf("\n") #para pular linha

mes = input('Month: ','s');
mes = tolower(mes);
printf("\n")

#beta = input('Inclinação do modulo: ');
#printf("\n")

lat = input('Latitude: ');
printf("\n")

gsc = 1367;

if mes == 'january'
  a = 1;
  endif
if mes == 'february'
  b = 2;
  endif
if mes == 'march'
  c = 3;
  endif

and is giving the following error when the month is February or March:

error: teste2: mx_el_eq: nonconformant arguments (op1 is 1x8, op2 is 1x7)
error: called from
    teste2 at line 19 column 1

has anyone ever experienced this ?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


I think you want
Built-in Function: strcmp (s1s2)
Return 1 if the character strings s1 and s2 are the same, and 0 otherwise. 


--
DASCertificate for 206392


reply via email to

[Prev in Thread] Current Thread [Next in Thread]