4 <title>Cropping Structures
</title>
7 <div><a href=
"./index.html">back to doc index
</a></div>
8 <p>Intended for use with the
<a href=
"./concatenating.html">cat
</a>
9 function, crop can do some powerful things. Crop accepts a number and
10 the data structure from which you want to crop.
</p>
11 <p>Start by initializing some variables.
</p>
12 <table width=
"100%" border=
"1"
13 style=
"text-align: center; font-family:monospace">
15 <td width=
"25%"><b>Input
</b></td>
16 <td width=
"15%"><b>Output
</b></td>
17 <td><b>Explanation
</b></td>
20 <td>(store
"A" (vcat (cat
3 5 7) (cat
2 4 6)
2))
</td>
21 <td>[
3 5 7]
<br/>[
2 4 6]
<br/>[
2 2 2]
</td>
24 <td>(store
"u" (vcat
1 2 3))
</td>
29 <td>[
3 5]
<br/>[
2 4]
<br/>[
2 2]
</td>
30 <td>Get the
2 left columns
<b>A
</b>.
</td>
34 <td>[
3 5 7]
<br/>[
2 4 6]
</td>
35 <td>Get the bottom
2 rows of
<b>A
</b>.
</td>
40 <td>Only one column vector cropped from the right of
<b>A
</b>,
41 it is automatically transformed into a vector.
</td>
46 <td>Like the previous example, only one element is cropped from
47 vector
<b>u
</b> so it is returned as a plain number.
<br/>
48 <b>NOTE:
</b> To get this effect, you must use vcrop instead
54 <td>Using crop on a vector just returns it.
</td>