help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: input a string


From: Andy Buckle
Subject: Re: input a string
Date: Mon, 22 Nov 2010 12:38:26 +0000

On Mon, Nov 22, 2010 at 12:32 PM, Isak Delberth Davids
<address@hidden> wrote:
> Hi all,
>
> I would like to put a character string into title plots. I managed by doing
>
> clear;clc;
> x = -30:30;
> y = sin(x);
> WhatItIs = 'sine curve'; % this is  OK
> plot(x,y)
> title(sprintf('This is my %s',WhatItIs),'FontSize',14,'FontWeight','bold');
>
> I was happy, but wanted to be a bit fancy --- I want the user to input the
> string at run time, so I did:
>
> clear;clc;
> x = -30:30;
> y = sin(x);
> WhatItIs = input('Please tell us what this is  '); % this fails
> plot(x,y)
> title(sprintf('This is my %s',WhatItIs),'FontSize',14,'FontWeight','bold');
>
> How should I write the line that request user input of a string?

I took a look at "help input". I think this should do the trick.

WhatItIs = input('Please tell us what this is  ','s')

-- 
/* andy buckle */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]