Multiple values in EditField?

8 次查看(过去 30 天)
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)?

采纳的回答

Mario Malic
Mario Malic 2021-2-23
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 个评论
Kristin Habersang
Kristin Habersang 2021-2-23
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 2021-2-23
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by