<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hi Michael,<br>
    <br>
    When I run the simulation a second time, I still get the "Protected
    variable name" and "Singularity in a block" (block EXPRESSION)
    errors.<br>
    <br>
    The attached diagram does what I think you are trying to do (without
    running the script).<br>
    That is, when the ramp block crosses zero, save the value of the
    sine block in Scilab environment and plot it.<br>
    The CLKSOMV_f block is just there to give an initial impulse to
    DOLLAR_f thanks to the added CLOCK_c block.<br>
    <br>
    As Serge stated, the variables are "transferred" to the Scilab
    environment at the end of the simulation, so there is no way of
    saving a variable AND loading it mid-simulation in one diagram.<br>
    <br>
    Hope this helps,<br>
    Regards,<br>
    Paul<br>
    <br>
    <div class="moz-cite-prefix">On 04/14/2014 05:01 PM, Michael
      Ungelehrt wrote:<br>
    </div>
    <blockquote cite="mid:006e01cf57f2$6ee9ec40$4cbdc4c0$@th-deg.de"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Sprechblasentext Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.SprechblasentextZchn
        {mso-style-name:"Sprechblasentext Zchn";
        mso-style-priority:99;
        mso-style-link:Sprechblasentext;
        font-family:"Tahoma","sans-serif";}
span.E-MailFormatvorlage19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Hello Paul,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">thank
            you for your answer.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
            had a look at the “DOLLAR” block. It’s a kind of delay
            block, but it’s not the right block for the task I have to
            do, I think.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
            attached a simulation file, which shows the problem. This is
            not the real simulation, because the real one is more
            complex.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">First
            of all I load the .sce file. If I start the simulation, the
            output shows the result with the initial value of C defined
            in the .sce file and I get the error message “Evaluation
            problem: value not updated from context. Protected variable
            name. Please choose another variable name.”<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">After
            I start the simulation a second time, the output graph shows
            the correct result and the error message doesn’t appear
            again.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Is
            there any possibility to write into my variable C at the
            beginning of the simulation? Or is it possible to do this
            task with the “DOLLAR” block like you thought?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Best
            regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Michael<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:DE"
                  lang="EN-US">Von:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:DE"
                lang="EN-US"> Paul Bignier
                [<a class="moz-txt-link-freetext" href="mailto:paul.bignier@scilab-enterprises.com">mailto:paul.bignier@scilab-enterprises.com</a>] <br>
                <b>Gesendet:</b> Donnerstag, 10. April 2014 12:35<br>
                <b>An:</b> International use</span><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:DE">rs
                mailing list for Scilab.; <a class="moz-txt-link-abbreviated" href="mailto:martin.buecherl@th-deg.de">martin.buecherl@th-deg.de</a><br>
                <b>Betreff:</b> Re: [Scilab-users] Problems with "To
                workspace" and "From workspace"<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
          Hi Michael,<br>
          <br>
          Indeed it looks like you can't overwrite a variable defined in
          the context.<br>
          Have you tried replacing the "FROMWSB" block with a "DOLLAR"
          block?<br>
          Then it would have the same data and activation inputs as the
          "TOWS_c" block,<br>
          and you would not need to pre-define 'C' (just give it an
          initial value in the block parameters).<br>
          <br>
          Hope this helps,<br>
          Regards,<br>
          Paul<br>
          <br>
          <o:p></o:p></p>
        <div>
          <p class="MsoNormal">On 04/10/2014 09:27 AM, Michael Ungelehrt
            wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span lang="EN-US">Dear users,</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I have a problem with
              the “To workspace” respectively “From workspace” block in
              Xcos.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I’d like to write the
              value of a function to workspace if the value of another
              function changes its sign from + to -. A short time later
              I’d like to use this value in a third function and
              retrieve it from workspace.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">For that I evaluate
              the first function with the “NEGTOPOS_f” block and give
              the output event to the “TOWS_c” block. The “TOWS_c” block
              is connected with the second function and should write the
              value to a vaiable A in the workspace.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">The “FROMWSB” block is
              connected with a third function which should use the
              variable that is saved before.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Now I have the
              following problem:</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">If I start the
              simulation, the “FROMWSB” says that the variable A does
              not exist. So my idea was to define the variable in the
              variable-browser before I start the simulation. If I do so
              I get an error at the “TOWS_c” block: “Evaluation problem:
              value not updated from context. Protected variable name.
              Please choose another variable name.”</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Is there any solution
              for that problem?</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><u><span lang="EN-US">Block parameters:</span></u><o:p></o:p></p>
          <p class="MsoNormal"><u><span lang="EN-US">From workspace:</span></u><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Variable
              name:                C</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Interpolation Method:
                              0</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Enable zero
              crossing:     1</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Output at
              end:                 1</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><u><span lang="EN-US">To workspace:</span></u><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Size of
              buffer:                  1</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Scilab variable
              name:     C</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Inherit:                               
              0</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><u><span lang="EN-US">Definition of
                variable C in SciNotes upfront:</span></u><o:p></o:p></p>
          <p class="MsoNormal">C.time=0;<o:p></o:p></p>
          <p class="MsoNormal">C.values=0;        <o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">Thank you in advance!<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Mit
              freundlichen Grüßen</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Best
              regards,</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Michael
              Ungelehrt</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"><img
                id="Bild_x0020_1"
                src="cid:part1.09060803.09070107@scilab-enterprises.com"
                alt="Logo_TC_Cham" height="133" width="138"></span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Michael
              Ungelehrt, B.Eng.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Laboringenieur</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">THD
              – Technische Hochschule Deggendorf<br>
              Technologie Campus Cham</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Badstraße
              21</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">D-93413
              Cham</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Tel:
              +49 9971 99673-29</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Fax:
              +49 9971 99673-69</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">E-Mail:
              <a moz-do-not-send="true"
                href="mailto:michael.ungelehrt@th-deg.de">michael.ungelehrt@th-deg.de</a></span><o:p></o:p></p>
          <p class="MsoNormal"><span style="mso-fareast-language:DE">Web:
              <a moz-do-not-send="true"
                href="http://www.tc-cham.th-deg.de/">www.tc-cham.th-deg.de</a></span><o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif";mso-fareast-language:DE"><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>users mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif";mso-fareast-language:DE"><br>
            <br>
            <o:p></o:p></span></p>
        <pre>-- <o:p></o:p></pre>
        <pre>Paul BIGNIER<o:p></o:p></pre>
        <pre>Development engineer<o:p></o:p></pre>
        <pre>-----------------------------------------------------------<o:p></o:p></pre>
        <pre>Scilab Enterprises<o:p></o:p></pre>
        <pre>143bis rue Yves Le Coz - 78000 Versailles, France<o:p></o:p></pre>
        <pre>Phone: +33.1.80.77.04.69<o:p></o:p></pre>
        <pre><a moz-do-not-send="true" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a> <o:p></o:p></pre>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Paul BIGNIER
Development engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a> </pre>
  </body>
</html>