- Create a property cam in the app designer:
How to select camera like drop down button APP designer?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jenifer NG
el 17 de Ag. de 2022
Comentada: Jenifer NG
el 17 de Oct. de 2022
Hi All,
I am learning to design an app that can select the avaiable camera from computer as fig bellow.
Could you help me or give some guide ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1100115/image.png)
Thanks !
0 comentarios
Respuesta aceptada
Ajay Gajulapally
el 17 de Oct. de 2022
Please Ensure you have the add-on: “MATLAB Support package for USB Webcams" installed before following the procedure.
properties (Access = private)
cam % Description
end
2. Create a startupFunction for the app which by default opens webcam 1
Include this code in the function.
app.cam = webcam(1);
preview(app.cam);
3. Create a Value Change function for the drop down and update the code:
function CameraDropDownValueChanged(app, event)
delete(app.cam);
value = app.CameraDropDown.Value;
if value == "Cam 1"
app.cam = webcam(1);
else
app.cam = webcam(2);
end
preview(app.cam);
end
4. Now try running the app. Hope this helps!
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!