<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8348&amp;type=atom" />
	<updated>2013-05-31T19:37:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8348</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72602#p72602" />
			<content type="html"><![CDATA[<p>Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-05-31T19:37:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72602#p72602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72597#p72597" />
			<content type="html"><![CDATA[<p>Я бы сделал так:<br /></p><div class="codebox"><pre><code>
Str =
(
1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
)
 
StringSplit, Arr, Str, `,`n, %A_Space% 
RegExReplace(Str, &quot;m`a)$&quot;, &quot;&quot;, Row), Col := Arr0 // Row, i := 1

Loop % Arr0
    Res .= Arr%i% (i = Arr0 ? &quot;&quot; : (half := Mod(A_Index, Row)) ? &quot;, &quot; : &quot;`n&quot;)
        , i := half ? i + Col : A_Index // Row + 1 
MsgBox % Res 
</code></pre></div><p>Тем более в случае когда заранее неизвестно кол-во линий и колонок.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-05-31T13:38:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72597#p72597</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72593#p72593" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>А можете эту формулу объяснить?<br /></p><div class="codebox"><pre><code>i := (row - 1) * columns + column
j := (column - 1) * rows + row</code></pre></div></blockquote></div><p>Вычисляется индекс числа в исходной и целевой таблицах. В исходной числа идут группами по четыре (количество колонок). Т.е. индекс равен какому-то количеству четвёрок + смещение в той четвёрке, где число находится. Первый ряд — это первая четвёрка. Целых четвёрок нет, индекс числа равен смещению в его четвёрке. Второй ряд — одна целая четвёрка + смещение, и т.д.</p><p>Для индекса в целевой таблице ряды и колонки меняются местами.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2013-05-31T10:58:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72593#p72593</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72592#p72592" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>К сожалению мне это мало, что дает.</p></blockquote></div><p> Если у вас эти цифры записаны в виде двухмерного массива, то, с помощью двух вложенных циклов как у <strong>YMP</strong>, меняете элементы местами: Элемент(x,y)&lt;=&gt;Элемент(y,x)... Если я правильно понял вашу постановку задачи.</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-31T10:46:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72592#p72592</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72587#p72587" />
			<content type="html"><![CDATA[<p>Спасибо!<br />А можете эту формулу объяснить?<br /></p><div class="codebox"><pre><code>i := (row - 1) * columns + column
j := (column - 1) * rows + row</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-05-31T07:20:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72587#p72587</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72585#p72585" />
			<content type="html"><![CDATA[<p>Вот что смог придумать:<br /></p><div class="codebox"><pre><code>
Src =
(
1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
)

rows = 3
columns = 4

StringSplit, SrcArr, Src, `,`n, %A_Space%

Loop, % rows
{
    row := A_Index
    Loop, % columns
    {
        column := A_Index
        i := (row - 1) * columns + column
        j := (column - 1) * rows + row
        DestArr%j% := SrcArr%i%
    }
}

Loop, % rows * columns
{
    Dest .= DestArr%A_Index% . (Mod(A_Index, rows) ? &quot;, &quot;:&quot;`n&quot;)
}

MsgBox, % Dest
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2013-05-31T03:12:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72585#p72585</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72582#p72582" />
			<content type="html"><![CDATA[<p>К сожалению мне это мало, что дает.<br />Наткнулся пока только на<br /><a href="https://github.com/acmeism/RosettaCodeData/blob/master/Task/Matrix-transposition/AutoHotkey/matrix-transposition.ahk">https://github.com/acmeism/RosettaCodeD … sition.ahk</a><br />А как его под себя переделать не соображу.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-05-31T00:10:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72582#p72582</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72581#p72581" />
			<content type="html"><![CDATA[<p>Это называется &quot;транспонировать матрицу&quot;? Тогда: Элемент(x,y)&lt;=&gt;Элемент(y,x)</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-30T23:49:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72581#p72581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Поменять расположение чисел с горизонтального в вертикальное]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72580#p72580" />
			<content type="html"><![CDATA[<p>Имею такую комбинацию чисел (как пример)<br />1, 2, 3, 4<br />5, 6, 7, 8<br />9, 10, 11, 12<br />Надо превратить их в<br />1, 5, 9<br />2, 6, 10<br />3, 7, 11<br />4, 8, 12<br />Голову уже сломал, как сделать превращение.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-05-30T21:48:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72580#p72580</id>
		</entry>
</feed>
