0
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
loadXcosLibs()
loadScicos()
filename="C:/x2cExample/final.xcos"
result= importXcosDiagram(filename)
typeof(scs_m)
scs_m.props.tf =0;
degree = struct()
degree.time = 1;
degree.values = response;
disp("What is the temp in degc?")
disp( degree)
farhenit = struct()
scicos_simulate(scs_m,list())
disp("What is the temp in degc?")
disp( degree)
disp("What is the temp in far?")
e= farhenit.values
t=farhenit.values
disp(e)
endfunction

//Error

-->deg_far

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 :
deg_far


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

Answers:

Log-in to answer to this question.