Octave.NET icon indicating copy to clipboard operation
Octave.NET copied to clipboard

if script include a function, will throw out error

Open zj2050 opened this issue 2 years ago • 7 comments

Hi,all: I have defined a function in script, like: disp("Running...") function result = myrand(n, t, p, d) a = 200 * t + p; big_rand = a * n; result = big_rand / 10**d; return;endfunction mrand = myrand(5379, 0, 91, 4)

the script can correct execute in octave, but when call: octave.Execute(script) will show error : "error: 'myrand' undefined near line 1, column 9\r\n"

how defined a function in script? thanks

zj2050 avatar Feb 06 '23 03:02 zj2050

@triforcely please give any suggestion? thanks

zj2050 avatar Feb 06 '23 03:02 zj2050

script = string.Format("disp("Running...")\n "+ "function result = myrand(n, t, p, d) a = 200 * t + p; big_rand = a * n; result = big_rand / 10**d; return;endfunction \n"+ "mrand = myrand(5379, 0, 91, 4) "));

this code phrase from octave

zj2050 avatar Feb 06 '23 03:02 zj2050

Hey @zj2050 . This seems to be a bug. I've reproduced it and internal response parsing logic causes Octave.NET to freeze when handling functions. I'll work on a fix, thanks for the report.

triforcely avatar Feb 06 '23 15:02 triforcely

Hey @zj2050 . This seems to be a bug. I've reproduced it and internal response parsing logic causes Octave.NET to freeze when handling functions. I'll work on a fix, thanks for the report.

Hi @triforcely thanks for great work, then fixed please @

zj2050 avatar Feb 07 '23 01:02 zj2050

Hi! I'm having the same problem too, I've been trying for days. Thanks in advance for the correction @triforcely !

Jacks321 avatar Feb 08 '23 10:02 Jacks321

I started looking into this issue and it doesn't seem to be very easy to fix. I don't have too much time to fix it at the moment, so feel free to look into it yourself, I'll be happy to merge your changes.

triforcely avatar Feb 10 '23 09:02 triforcely

@triforcely @CptWesley

o

It's a very bad news

zj2050 avatar Feb 13 '23 06:02 zj2050