Web app with input parameter as a url argument

조회 수: 6 (최근 30일)
Rachid Rezgui
Rachid Rezgui 2023년 8월 25일
댓글: Rachid Rezgui 2025년 9월 7일
How can I pass an argument from the url of the app to the app? Say for example the app is a dropdown with 3 items. The url is www.matlabapp.com/app1. if I type www.matlabapp.com/app1?dropdownItem=2 in the browser, it should automatically preselect the 2nd item from the drop down.

답변 (1개)

Dev
Dev 2025년 8월 29일
The question mentions a Web app, so I am assuming that you have a MATLAB App here, which is most likely a MATLAB Web App deployed using the "MATLAB Web App Server". Our aim is to accept URL query parameters and use them inside the app, such as to preselect a dropdown item.
"MATLAB Web App Server" provides access to URL query parameters using the "getWebAppServerData" function inside your app. I have mentioned a minimal working step-by-step example below which helps us achieve the dropdown functionality-
  • Create a simple app with a dropdown in "MATLAB App Designer":
Add a "uidropdown" component.
In the startupFcn of the app, read the query parameter.
  • Code the functionality of the startupFcn in the in "App Designer". We use the "getWebAppServerData" function here to get the query parameters from the URL.
  • Deploy the app to "MATLAB Web App Server" and access it with a query parameter.
For more information on the usage of the tools and functions mentioned above, please refer to the documentation links below-
I hope the above information helps to solve the query.
  댓글 수: 1
Rachid Rezgui
Rachid Rezgui 2025년 9월 7일
Hello, yes I am using exactly that bit i can not find the getWebAppServerData function anywhere. Not even in the docuementation. All I need is the query from the link that i can use to preload the app when the startup function is triggered.

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

카테고리

Help CenterFile Exchange에서 MATLAB Web App Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by