Kindly guide how to add the single edit field for each RLC like [0.01, ...] and different time interval [10, 20, 30] in app designer and also the phase result on interfaces

Kindly guide how to add the single edit field for each RLC like [0.01, ...] and different time interval [10, 20, 30] in app designer

回答 (1 件)

Hi @Ehtisham, from what I understand you want to get a numerical vector from an edit field when you enter a string like “[10,20,30]” into the edit field. You can make use of the ‘erase’ and ‘split’ functions to filter out the required numeric strings and then use the ‘str2double’ function to convert it into a numeric vector. Here’s a link to a similar MATLAB Answer:
Here’s the code that you can put in your button callback function:
RLC = app.RLCtoEC50EditField.Value;
RLC = erase(RLC,{'[',']'});
RLC = split(RLC,','); %Separate the elements by comma ','
%Do not use both space and comma to separate elements during input.
%If separating by space use below command instead
%RLC = split(RLC,' ');
RLC = str2double(RLC); %Convert string vector to double vector
%Similarly, do it for time intervals
Hope that helps!

7 件のコメント

Ehtisham
Ehtisham 2024 年 8 月 7 日
編集済み: Ehtisham 2024 年 8 月 7 日
Thanks for your help. I do not know how i incoperate this whether in the UIAxes Button or introduce the new call back function for both @Divyajyoti Nayak. Just check i put this in the UIAxes and calling also form UIAxes. but its not working and even giving a error(put numeric value) when i put commas. kindly guide me what to do next.
Divyajyoti Nayak
Divyajyoti Nayak 2024 年 8 月 7 日
編集済み: Divyajyoti Nayak 2024 年 8 月 7 日
In the UIAxesButton callback function you are taking the RLC value from the edit field and passing it into the 'TestCode1' function call right? So you just add these lines to it, where you're defining RLC and write similar code for the time intervals but make sure to add another edit field for time intervals. For a button you can have only one callback function.
Ehtisham
Ehtisham 2024 年 8 月 7 日
編集済み: Ehtisham 2024 年 8 月 7 日
See i did what your said but still its not working and when i run and put values in the RLC value box its gives error(Value must be numeric) (@Divyajyoti Nayak
Divyajyoti Nayak
Divyajyoti Nayak 2024 年 8 月 8 日
編集済み: Divyajyoti Nayak 2024 年 8 月 8 日
@Ehtisham, you have used an edit field(numeric) which only takes numeric data as input. You'll need to replace them with edit field(text) since we are taking a string and converting to numeric vector.
Ehtisham
Ehtisham 2024 年 8 月 8 日
Yes i tried like this but it is giving error unrecognied method, property or field 'RLCtoEC50EditField' for class 'Phase11'
@Ehtisham thats because the new edit field's name is not 'RLCtoEC50EditField'. You have changed it to 'RLCValuesEditField'
Ehtisham
Ehtisham 2024 年 8 月 8 日
@Divyajyoti Nayak can you fix this problem and share a file with me. It will be very help ful for me

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeControl System Toolbox についてさらに検索

製品

リリース

R2023a

タグ

質問済み:

2024 年 8 月 7 日

コメント済み:

2024 年 8 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by