Scilab to xcos and xcos to scilab communication

Hi All,

I am very new to scilab , I was trying to excute this simple example where i pass degrees to xcos model and xcos returns farenit.

Please can you all help me figure out what i am doing wrong ?

Below is the functionand the error :-

global response;
response = evstr(x_dialog('What is the temp in degc?','0'))

function [t,e] = deg_far(response)
//Define Symbolic parameters
global response
result= importXcosDiagram(filename)
scs_m.props.tf =0;
degree = struct()
degree.time = 1;
degree.values = response;
disp("What is the temp in degc?")
disp( degree)
farhenit = struct()
disp("What is the temp in degc?")
disp( degree)
disp("What is the temp in far?")
e= farhenit.values



What is the temp in degc?

time: 1
values: 23

!Evaluation problem: value not updated from context. !
! !
!Protected variable name. !
! !
!Please choose another variable name. !
NamesIval = farhenit_val;
!--error 4
Undefined variable: farhenit_val
in execstr instruction called by :
at line 53 of function do_terminate1 called by :
at line 298 of function scicos_simulate called by :
at line 16 of function deg_far called by :

Scilab 12-06-19, 5:22 a.m. GirijaB

If you are new to scilab, this is a more difficult way to call xcos. I would suggest you do the following first.

  1. Write a function that accepts an integer representing the degree celcius value and converts it in to Faranhite and returns it.
  2. Use this function from the scilab console to ensure it is working as per requirement
  3. Build an xcos diagram that uses a "sci-func" block to call your function. This block has the ability to call any user-defined function. See this spoken tutorial to understand what I am saying.


26-12-19, 12:38 p.m. rupakrokade

Log-in to answer to this question.