Accessing User Data in Standalone App

I have created an app that I plan to compile as a standalone executable, but I have run into an issue regarding how to access user data. The app is an image processing algorithm that allows the user to analyze a folder of images on their computer. Originally I had the program add the user's folder to the matlab path using uigetdir, although this has run into issues once I compile the app. I know that modifying the path of a compiled app causes issues, so I am wondering how would I be able to read in a folder of images from the user's computer?

 Respuesta aceptada

Turlough Hughes
Turlough Hughes el 24 de Sept. de 2022

0 votos

You can store image paths in a property in your app (see imageFiles in the attached .mlapp file) and then use that to load the images.

3 comentarios

Zachary Kalmanson
Zachary Kalmanson el 24 de Sept. de 2022
Hi thank you so much for the answer, I also forgot to mention one other issue. When I try using uigetdir, I want to be able to select a folder that has subfolders in it. But when I do this, it doesn't access the images in any of the subfolders. Do you know a way of doing this?
Assuming they're all png's (simply for the purpose of demonstration), you can write the following
app.imageFiles = dir(fullfile(userSelectedFolder,'**','*.png'))
This will scan down all the subfolders for png's.
Zachary Kalmanson
Zachary Kalmanson el 27 de Sept. de 2022
Thank you for the help. I have one follow up question if you don't mind. I see that the imageFiles data structure stores the file names as well as the folder they came from, but its in one big list. is it possible to seperate them so that the images from each subfolder are stored in a seperate imageFiles structure? Otherwise I am not sure how I would reference the images from each subfolder.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Preguntada:

el 24 de Sept. de 2022

Comentada:

el 27 de Sept. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by