<html lang="en"> <head> <title>Creating Strings - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Strings.html#Strings" title="Strings"> <link rel="prev" href="Character-Arrays.html#Character-Arrays" title="Character Arrays"> <link rel="next" href="Comparing-Strings.html#Comparing-Strings" title="Comparing Strings"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Creating-Strings"></a> <p> Next: <a rel="next" accesskey="n" href="Comparing-Strings.html#Comparing-Strings">Comparing Strings</a>, Previous: <a rel="previous" accesskey="p" href="Character-Arrays.html#Character-Arrays">Character Arrays</a>, Up: <a rel="up" accesskey="u" href="Strings.html#Strings">Strings</a> <hr> </div> <h3 class="section">5.3 Creating Strings</h3> <p>The easiest way to create a string is, as illustrated in the introduction, to enclose a text in double-quotes or single-quotes. It is however possible to create a string without actually writing a text. The function <code>blanks</code> creates a string of a given length consisting only of blank characters (ASCII code 32). <!-- ./strings/blanks.m --> <p><a name="doc_002dblanks"></a> <div class="defun"> — Function File: <b>blanks</b> (<var>n</var>)<var><a name="index-blanks-287"></a></var><br> <blockquote><p>Return a string of <var>n</var> blanks, for example: <pre class="example"> blanks(10); whos ans; ⇒ Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 1x10 10 char </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002drepmat.html#doc_002drepmat">repmat</a>. </p></blockquote></div> <ul class="menu"> <li><a accesskey="1" href="Concatenating-Strings.html#Concatenating-Strings">Concatenating Strings</a> <li><a accesskey="2" href="Conversion-of-Numerical-Data-to-Strings.html#Conversion-of-Numerical-Data-to-Strings">Conversion of Numerical Data to Strings</a> </ul> </body></html>