<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/</id><updated>2022-08-29T21:22:25.521000Z</updated><subtitle>Recent posts to multiplying 2 arrays in codesys</subtitle><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f/b871/ea1a/a03d/94fe/96c4" rel="alternate"/><published>2022-08-29T21:22:25.521000Z</published><updated>2022-08-29T21:22:25.521000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.com67338aa2722b300ec396f3c01b7a645b3d6b15bb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Initializing to zero is always a good idea to be sure variables are empty before a calculation.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f/b871/ea1a/a03d/94fe" rel="alternate"/><published>2022-08-29T20:41:00.050000Z</published><updated>2022-08-29T20:41:00.050000Z</updated><author><name>nehaltrivedi</name><uri>https://forge.codesys.com/u/nehaltrivedi/</uri></author><id>https://forge.codesys.comf08c97cc7577b8ab1a4b6a6ab970fafafdfec547</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Do i need to initialise C&lt;span&gt;[k,i]&lt;/span&gt; to 0's?&lt;br/&gt;
Something like this: &lt;br/&gt;
c: array &lt;span&gt;[1..5,1..5]&lt;/span&gt; of real := &lt;span&gt;[25(0)]&lt;/span&gt;;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f/b871/ea1a/a03d" rel="alternate"/><published>2022-08-27T18:01:20.129000Z</published><updated>2022-08-27T18:01:20.129000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.com980b666eb5ce5bfadcc042a8e246f7ed473f98bc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Okay so here is the loop(s) needed for the calculation:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;for i := 1 to 5 do&lt;/span&gt;
&lt;span class="err"&gt;  for j := 1 to 5 do&lt;/span&gt;
&lt;span class="err"&gt;    for k := 1 to 2 do&lt;/span&gt;
&lt;span class="err"&gt;      c[k,i] := c[k,i] + (a[k,j]*b[j,i]);&lt;/span&gt;
&lt;span class="err"&gt;    end_for;&lt;/span&gt;
&lt;span class="err"&gt;  end_for;&lt;/span&gt;
&lt;span class="err"&gt;end_for;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f/b871/ea1a" rel="alternate"/><published>2022-08-22T09:27:08.386000Z</published><updated>2022-08-22T09:27:08.386000Z</updated><author><name>nehaltrivedi</name><uri>https://forge.codesys.com/u/nehaltrivedi/</uri></author><id>https://forge.codesys.comc25990e8c5e262427578755a1de1e50038add17b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes sorry C would be a new array. I want something like this c=a*b; I have edited the original problem statement.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f/b871" rel="alternate"/><published>2022-08-18T10:45:58.559000Z</published><updated>2022-08-18T10:45:58.559000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.com4019afa3904e8d8782124e98b73fecedd3c0b662</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;But C would be a new array, or do you want the array elements of C summed up?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865/763f" rel="alternate"/><published>2022-08-18T08:47:08.990000Z</published><updated>2022-08-18T08:47:08.990000Z</updated><author><name>nehaltrivedi</name><uri>https://forge.codesys.com/u/nehaltrivedi/</uri></author><id>https://forge.codesys.com0d15377bd7cf12553d312cb5ba0f35604a1673b9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I wanted to multiply the matrix a and matrix b which yields the result c = a*b. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586/7865" rel="alternate"/><published>2022-08-18T06:21:02.036000Z</published><updated>2022-08-18T06:21:02.036000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.com86241f9a42487c723264b804b1ee9a634d39e8c0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Maybe i do not understand how you want them multiplied?&lt;br/&gt;
I was thinking of something like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;end_for&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="n"&gt;end_for&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b/f586" rel="alternate"/><published>2022-08-17T10:37:05.197000Z</published><updated>2022-08-17T10:37:05.197000Z</updated><author><name>nehaltrivedi</name><uri>https://forge.codesys.com/u/nehaltrivedi/</uri></author><id>https://forge.codesys.com69ef2517f1aedaca585f74351562d736431c1305</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am not able to identify what you are trying to tell, would be great if you can explain.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#336b" rel="alternate"/><published>2022-08-09T08:47:31.964000Z</published><updated>2022-08-09T08:47:31.964000Z</updated><author><name>ojz0r</name><uri>https://forge.codesys.com/u/ojz0r/</uri></author><id>https://forge.codesys.com9e17fedde7e1a324048dcd365d71b88fddb535c4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Since you already got the values in arrays cant you just loop through them?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>multiplying 2 arrays in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c1cb57fe3f/?limit=25#fda6" rel="alternate"/><published>2022-08-08T18:29:03.778000Z</published><updated>2022-08-08T18:29:03.778000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.comf85bc35e9518726e1d498ffc3939ff4c967414dd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I don't know of another way. I guess you could find an algorithm and convert it manually to IEC 61131-3.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>