<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with deeptostring() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=deeptostring%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:11:28 +0000</pubDate>
         <description>Tagged with deeptostring() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggeddeeptostring%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>printing 2darray as text...</title>
      <link>https://forum.processing.org/two/discussion/25042/printing-2darray-as-text</link>
      <pubDate>Thu, 16 Nov 2017 09:02:16 +0000</pubDate>
      <dc:creator>SlimJimCantSwim</dc:creator>
      <guid isPermaLink="false">25042@/two/discussions</guid>
      <description><![CDATA[<p>Hi, i've searched for a while and I'm not sure if i'm missing something obvious, i'm trying to print a 2d integer array as text, i did it before but I can't remember how i did and it is driving me insane.</p>

<p>thanks.</p>

<pre><code>void setup() {

  size(300, 300);
  background(255);
  array();
}

void array() {

  int[][] arrayinit = {
    { 10, 5, 3, 55, 90 }, 
    {  9, 4, 2, 32, 22 }, 
    {  3, 8, 5, 79, 22 }, 
    {  3, 8, 45, 4, 2 }, 
    {  3, 22, 5, 44, 4 }
  };

  int rows = 5;
  int cols = 5;

  int[] sum = new int[cols];
  int[] sum2 = new int[rows];
  stroke(0);
  for (int c=0; c&lt;cols; c++) { // for every column
    for (int r=0; r&lt;rows; r++) { // for every row
      rect(40*r, 30*c, 40, 30);
      text(arrayinit[c][r], 40*r, 30*c); //dont know if this is right
      sum[c] += arrayinit[r][c]; // sum up the values per column
      sum2[r] += arrayinit[r][c];
    }
  }

  println(sum[0]); 
  println(sum[1]); 
  println(sum[2]); 
  println(sum2[2]);
  println(arrayinit[2][2]);
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>