필터 지우기
필터 지우기

switch command on listbox value

조회 수: 3 (최근 30일)
Iheb Maddouri
Iheb Maddouri 2021년 5월 18일
편집: Turlough Hughes 2021년 5월 19일
Hi all,
I am working on a GUI in appdesigner and I want to plot something but depending on the user slection of some parameters in a listbox.
it works fine when I don't use multiselect. But I want to plot the parameters on the same plot using multiselection.
For example if I select number 1 it plots number one and if I also want to simultaneously want to select number 2 I want that aslo to be plotted on the same figure and when I deselect it I want to disappear. Can anyone help me pleae.
I will be glad to share some of the code if it is not understandable.

채택된 답변

Turlough Hughes
Turlough Hughes 2021년 5월 18일
편집: Turlough Hughes 2021년 5월 18일
You can get an index of the selected values as follows:
idx = ismember(app.ListBox.Items,app.ListBox.Value);
Then, make the plots visible or invisible based on your index. See the demo attached.
  댓글 수: 2
Iheb Maddouri
Iheb Maddouri 2021년 5월 19일
Thank you it worked but I have a new problem
when I deselct the parameter it is still showing. I am using rfplot and the parameters are S parameters
Turlough Hughes
Turlough Hughes 2021년 5월 19일
편집: Turlough Hughes 2021년 5월 19일
Plots not currently selected in the callback have their visibility turned off by
[app.pHandles(~idx).Visible]=deal('off');
So I would say double check that line in your code, otherwise I would need more info (e.g. the .mlapp file).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by