Multiple values in EditField?

10 Ansichten (letzte 30 Tage)
Kristin Habersang
Kristin Habersang am 23 Feb. 2021
Hello So I want to plot multiple functions into one axis, using a GUI. When I run the GUI there should be one EditField, where I type in the number of sinus functions and then for example one EditField where i can put in multiple amplitudes. These functions should be plotted in the end. But is it even possible to put multiple values into one EditField(text)?

Akzeptierte Antwort

Mario Malic
Mario Malic am 23 Feb. 2021
Hello,
Yes, you can. You'll have to use the str2num function to get the numeric array from the Edit Field (text) component.
>> a = '1, 2, 3' % character array
a =
'1, 2, 3'
>> str2num(a)
ans =
1 2 3 % numeric array
  2 Kommentare
Kristin Habersang
Kristin Habersang am 23 Feb. 2021
thank you :) ahh okay, so I can just seperate the numbers in with a comma?
And in my code, how do I have access to the single numbers or how can I use them there?
Because I want to type in the numbers after the code and GUI is finished
Mario Malic
Mario Malic am 23 Feb. 2021
Comma or space is good enough if you want to input a vector.
The output from
b = str2num(a);
% b is a vector 1x3
b(1) % returns 1
b(2) % returns 2 and so on

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by