How to use user input data in my code?

I'd ask the user to input a station name. Example:
prompt = 'What is the station name?'
name = input(prompt);
Then I'd use the input in my code. Example
load name.txt
Where name is the station name they just input.
Thanks in advance.

 Akzeptierte Antwort

James Tursa
James Tursa am 8 Jul. 2015

1 Stimme

name = input(prompt,'s');
load([name '.txt'])

Weitere Antworten (0)

Kategorien

Gefragt:

am 8 Jul. 2015

Kommentiert:

am 8 Jul. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by