Multiple values in EditField?

14 views (last 30 days)
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)?

Accepted Answer

Mario Malic
Mario Malic on 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 Comments
Kristin Habersang
Kristin Habersang on 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 on 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

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!