<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Compare 2 variables STRUCT</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e01fecaddd/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e01fecaddd/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e01fecaddd/</id><updated>2020-02-27T21:52:18.873000Z</updated><subtitle>Recent posts to Compare 2 variables STRUCT</subtitle><entry><title>Compare 2 variables STRUCT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e01fecaddd/?limit=25#9ffa" rel="alternate"/><published>2020-02-27T21:52:18.873000Z</published><updated>2020-02-27T21:52:18.873000Z</updated><author><name>Anthony</name><uri>https://forge.codesys.com/u/anthony/</uri></author><id>https://forge.codesys.com9dae940630e813c76fb7d4243f7fe54d16e3f22f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your help.&lt;br/&gt;
I found some information on oscat to solve my problem.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Compare 2 variables STRUCT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e01fecaddd/?limit=25#1c5d" rel="alternate"/><published>2020-02-27T21:52:17.316000Z</published><updated>2020-02-27T21:52:17.316000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com6631a0f33b08fb87f53963d412d153128841a0e8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;you will have to use pointers in this case.&lt;br/&gt;
off course you can compare the internal of the structures like VAR1.A3&lt;span&gt;[1]&lt;/span&gt; etc.&lt;br/&gt;
In the oscat.lib is a function to do this.&lt;/p&gt;
&lt;p&gt;however it is not 61131, but it works.&lt;br/&gt;
&lt;a class="" href="http://forum.codesys.com/viewtopic.php?f=11&amp;amp;t=5962" rel="nofollow"&gt;http://forum.codesys.com/viewtopic.php?f=11&amp;amp;t=5962&lt;/a&gt;&lt;br/&gt;
was also about this subject&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Compare 2 variables STRUCT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e01fecaddd/?limit=25#13d8" rel="alternate"/><published>2020-02-27T21:52:13.068000Z</published><updated>2020-02-27T21:52:13.068000Z</updated><author><name>Anthony</name><uri>https://forge.codesys.com/u/anthony/</uri></author><id>https://forge.codesys.com34fd5d6b0191dd54b27a29efd03e23ab41787d59</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hello,&lt;/p&gt;
&lt;p&gt;I would like to know if it's possible to compare 2 variables when they are 2 structures.&lt;/p&gt;
&lt;p&gt;For exemple, I have a structure&lt;br/&gt;
TYPE ST_HmiToPlc :&lt;br/&gt;
STRUCT&lt;br/&gt;
  B1 : bool;&lt;br/&gt;
  B2 : bool;&lt;br/&gt;
  A3 : array&lt;span&gt;[1..9]&lt;/span&gt; of bool;&lt;br/&gt;
  I4 : int;&lt;br/&gt;
END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;
&lt;p&gt;I declare 2 variables &lt;br/&gt;
Var1 : ST_HmiToPlc;&lt;br/&gt;
Var2 : ST_HmiToPlc;&lt;/p&gt;
&lt;p&gt;And know I would like to know if values in VAR1 are différents than values in VAR2&lt;br/&gt;
I wrote&lt;br/&gt;
  if VAR1&amp;lt;&amp;gt;VAR2 then TOTO:=TRUE; end_if&lt;br/&gt;
But it's not correct, I have the fault&lt;span style="color: #FF0000;"&gt; ERROR 4011: Type mismatch in parameter 1 of ''&amp;lt;&amp;gt;'' : Cannot convert 'ST_HmiToPlc' to 'ANY_NUM'&lt;/span&gt;&lt;br/&gt;
Do you have a solution ? I don't want to compare each value of the structure because I have near 200 values in my structure.&lt;/p&gt;
&lt;p&gt;I know you can do this :&lt;br/&gt;
VAR1 := VAR2;&lt;br/&gt;
without fault, so I think it's possible to make some calcul on the VAR1&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>