Good Day!,
I am trying to run some code but got stuck at this portion with the error code:
Open /* */ comment G0562 : 'endif'
Any guidance to solve the problem please.
regards,
ozey
if (p1==0)and(p2==0);
cris=data[1:rows(data)-h,2];
x=x~cris;
elseif p1>p2;
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
elseif p1<p2;
cris=data[(p2+1):rows(data)-h,2];
x=x~cris;
elseif (p1==p2)and(p2/=0);
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
endif;
2 Answers
0
Hello Ozey,
The error
Open /* */ comment G0562 : 'endif'
indicates that you have a C-style comment (/* */
) right after an endif
statement.
If we add a little code to define the neede variables, we can run your code snippet without problem like this:
// Assign variables so code snippet will run
p1 = 0;
p2 = 0;
h = 1;
data = rndn(10,2);
x = {};
if (p1==0)and(p2==0);
cris=data[1:rows(data)-h,2];
x=x~cris;
elseif p1>p2;
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
elseif p1<p2;
cris=data[(p2+1):rows(data)-h,2];
x=x~cris;
elseif (p1==p2)and(p2/=0);
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
endif;
However, if we add an open C-style comment after the last line like this:
p1 = 0;
p2 = 0;
h = 1;
data = rndn(10,2);
x = {};
if (p1==0)and(p2==0);
cris=data[1:rows(data)-h,2];
x=x~cris;
elseif p1>p2;
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
elseif p1<p2;
cris=data[(p2+1):rows(data)-h,2];
x=x~cris;
elseif (p1==p2)and(p2/=0);
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
endif;
/*
Then we will get the error
Open /* */ comment G0562 : 'endif'
You need to close that comment to resolve this problem.
0
Thanks for your kind assistance.
Very much appreciated.
Ozey
Your Answer
2 Answers
Hello Ozey,
The error
Open /* */ comment G0562 : 'endif'
indicates that you have a C-style comment (/* */
) right after an endif
statement.
If we add a little code to define the neede variables, we can run your code snippet without problem like this:
// Assign variables so code snippet will run
p1 = 0;
p2 = 0;
h = 1;
data = rndn(10,2);
x = {};
if (p1==0)and(p2==0);
cris=data[1:rows(data)-h,2];
x=x~cris;
elseif p1>p2;
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
elseif p1<p2;
cris=data[(p2+1):rows(data)-h,2];
x=x~cris;
elseif (p1==p2)and(p2/=0);
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
endif;
However, if we add an open C-style comment after the last line like this:
p1 = 0;
p2 = 0;
h = 1;
data = rndn(10,2);
x = {};
if (p1==0)and(p2==0);
cris=data[1:rows(data)-h,2];
x=x~cris;
elseif p1>p2;
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
elseif p1<p2;
cris=data[(p2+1):rows(data)-h,2];
x=x~cris;
elseif (p1==p2)and(p2/=0);
cris=data[(p1+2):rows(data)-h,2];
x=x~cris;
endif;
/*
Then we will get the error
Open /* */ comment G0562 : 'endif'
You need to close that comment to resolve this problem.
Thanks for your kind assistance.
Very much appreciated.
Ozey