Multiple values in EditField?

조회 수: 14 (최근 30일)
Kristin Habersang
Kristin Habersang 2021년 2월 23일
편집: Kristin Habersang 2022년 4월 5일
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