DrDRB
DrDRB

Reputation: 1

Loading function files in Scilab

I am new to Scilab, but I do have MatLab and Octave experience. I'm just starting to write custom functions and when I try to load them into Scilab, I get the following error.

!--error 10000 
listvarinfile: Wrong variable type (1.686D+08) found in '<pathname>\test.sci'. File may be wrong or corrupted.
at line      50 of function listvarFunction called by :  
at line      29 of function listvarinfile called by :  
at line     949 of function %_sodload called by :  
<pathname>\test.sci'

In this case the test file was pretty simple:

function [x]=test(y)

x = y*y;

endfunction

saved with the .sci extension.

The function was loaded from the IDE by right clicking on the file and choosing the Load into Scilab option.

I had more complex examples but decided to write this since they were not loading either.

Thanks for your help.

Upvotes: 0

Views: 5246

Answers (2)

spoorcc
spoorcc

Reputation: 2955

Just as user2240469 said, but you can do this in the console. See also the documentation of exec.

 // Use -1 as mode to prevent printing everything in the console
 -->exec('test.sci',-1)

 -->test(4)

 ans = 

 16.

Upvotes: 0

user2240469
user2240469

Reputation: 53

Unlike in Matlab, in scilab you need run the function.

Just run the function first and then call it in the console .

test(4)

ans =

16.  

Upvotes: 1

Related Questions