help-octave
[Top][All Lists]
Advanced

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

input a string


From: Isak Delberth Davids
Subject: input a string
Date: Mon, 22 Nov 2010 14:32:34 +0200

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?

Hoping that I made my issue clear...
Isak


* * * * * * * * * * * * * * *
*  Isak Delbert Davids *
*  +264-81-33 049 33  *
*  +264-61-206 3789   *
*    Namibia, Afrika     *
* * * * * * * * * * * * * * *


reply via email to

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