how to get value from work space
Mostrar comentarios más antiguos
hello I am working on project . for exmaple i have this code
clc;
clear all;
a=input('enter a:');
title=(' the value of a is :');
I want the title to show the value of the variable a that I insert. how to do it ?
1 comentario
Respuestas (2)
KSSV
el 6 de En. de 2017
clc;
clear all;
a=input('enter a:');
title = sprintf('The value of a is:%f',a)
It is highly recommended to use the non-evaluating syntax of input, which is faster and much more secure:
>> str = input('input value a: ','s');
input value a: 5.6
>> val = str2double(str)
val = 5.6000
And put it into your title using either of these:
>> txt = sprintf('the value of a is %s',str)
txt = the value of a is 5.6
>> txt = sprintf('the value of a is %s',num2str(val))
txt = the value of a is 5.6
Categorías
Más información sobre Title en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!