<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Are there ways to populate a 5x5 matrix with values 101..505 without using loops? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792136#M97066</link>
    <description>&lt;P&gt;Got one, finally. It ain't pretty though&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = shape(mod(0::24, 5) + 1, 5);

#=&amp;gt; [1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5]

b = shape(floor(index(10, 58, 2) / 10), 5) * 100;

#=&amp;gt; [100 100 100 100 100,
200 200 200 200 200,
300 300 300 300 300,
400 400 400 400 400,
500 500 500 500 500]

a+b;

#=&amp;gt; [101 102 103 104 105,
201 202 203 204 205,
301 302 303 304 305,
401 402 403 404 405,
501 502 503 504 505]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 31 Aug 2024 01:46:14 GMT</pubDate>
    <dc:creator>mtowle419</dc:creator>
    <dc:date>2024-08-31T01:46:14Z</dc:date>
    <item>
      <title>Are there ways to populate a 5x5 matrix with values 101..505 without using loops?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792046#M97064</link>
      <description>&lt;P&gt;Surely there are ways!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Loop version:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ii = 1::5; jj = 1::5;

m = j(5,5);

foreach({i}, ii,
	foreach({j}, jj,
		m[i,j] = i*100 + j
	)
);

m;

#=&amp;gt; [ 101 102 103 104 105, 
	201 202 203 204 205, 
	301 302 303 304 305, 
	401 402 403 404 405, 
	501 502 503 504 505];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Multiple solutions encouraged, if you have them! I'm trying to "get fluent" in matrices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Aug 2024 00:02:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792046#M97064</guid>
      <dc:creator>mtowle419</dc:creator>
      <dc:date>2024-08-31T00:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Are there ways to populate a 5x5 matrix with values 101..505 without using loops?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792136#M97066</link>
      <description>&lt;P&gt;Got one, finally. It ain't pretty though&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = shape(mod(0::24, 5) + 1, 5);

#=&amp;gt; [1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5,
1 2 3 4 5]

b = shape(floor(index(10, 58, 2) / 10), 5) * 100;

#=&amp;gt; [100 100 100 100 100,
200 200 200 200 200,
300 300 300 300 300,
400 400 400 400 400,
500 500 500 500 500]

a+b;

#=&amp;gt; [101 102 103 104 105,
201 202 203 204 205,
301 302 303 304 305,
401 402 403 404 405,
501 502 503 504 505]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Aug 2024 01:46:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792136#M97066</guid>
      <dc:creator>mtowle419</dc:creator>
      <dc:date>2024-08-31T01:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Are there ways to populate a 5x5 matrix with values 101..505 without using loops?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792155#M97067</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = J( 5, 5, . );
Parallel Assign( {}, x[r, c] = 100 * r + c );
x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;[101 102 103 104 105,
201 202 203 204 205,
301 302 303 304 305,
401 402 403 404 405,
501 502 503 504 505]&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;n = 5;
x = 1 :: n;
y = 100 * x;
Repeat( x, n ) + Repeat( y, n )`;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;[101 102 103 104 105,
201 202 203 204 205,
301 302 303 304 305,
401 402 403 404 405,
501 502 503 504 505]&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Aug 2024 03:06:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792155#M97067</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-08-31T03:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Are there ways to populate a 5x5 matrix with values 101..505 without using loops?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792391#M97071</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;(101::105) |/ (201::205) |/ (301::305) |/ (401::405) |/ (501::505)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Aug 2024 11:22:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792391#M97071</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2024-08-31T11:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Are there ways to populate a 5x5 matrix with values 101..505 without using loops?</title>
      <link>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792412#M97072</link>
      <description>&lt;P&gt;Can get slow but you can also use JSL code with J() function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

n = 5;

i = 1;
m = J(n, n, 
	Ceiling(i / n) * 100 + Mod(i++ - 1, n) + 1
);&lt;BR /&gt;&lt;BR /&gt;Write();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Aug 2024 12:03:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Are-there-ways-to-populate-a-5x5-matrix-with-values-101-505/m-p/792412#M97072</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-31T12:03:25Z</dc:date>
    </item>
  </channel>
</rss>

