I want to know how to overcome executable standalone app - image write path error?
6 views (last 30 days)
Lowhikan Sivananthasarma on 31 May 2020
I have been working on Stereo Image capturing standalone app for my univeristy lab experiments. But I'm facing a problem while saving images in a selected path.
Basically what i'm trying to develop is when by pushing select save location button, it should allow me to select the folder where i want to save my images. Then when i click capture stereo images button, it should capture images and save the files in my choosen directory.
For time being,i use my webcam for capturing both images.When i run the code inside the Matlab app designer it works perfectly save the image files wherever i want.But if i export the app as standalone desktop app, it captures the images but it could not save images in any folder.
When i try to solve the issue, i found that i need to use isdeplyoed function. I tried but i could not solve the issue. Also i tried to save in the default ctfroot folder, then it says you don't have write permission.
This is my first app design and first question, So please be kind enough to overcome this problem.
It would be helpful if you can provide any similar app design ideas.
I have attched the parts of code where i have problems and relevant images with this email.
Thanks in advance.
properties (Access = private)
numOfPictures = 5;
waitTime = 1;
LeftvideoInputNumber = 1;
RightvideoInputNumber = 1;
oldpath= "H:\MATLAB App"
NumberOfTimesButtonHit = 0;
properties (Access = public)
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
app.VDR = videoinput('winvideo',app.LeftvideoInputNumber);
app.VDL = videoinput('winvideo',app.RightvideoInputNumber);
% Button pushed function: CaptureStereoImagesButton
function CaptureStereoImagesButtonPushed(app, event)
LeftFrameStereo = getsnapshot(app.VDL);
RightFrameStereo = getsnapshot(app.VDR);
app.NumberOfTimesButtonHit = app.NumberOfTimesButtonHit + 1 ;
dtv=strrep(dtv,':','_'); %Replace colon with underscore
dtv=strrep(dtv,'-','_');%Replace minus sign with underscore
dtv=strrep(dtv,' ','_');%Replace space with underscore
% Save the frames to images in Calibration Images folder
% Button pushed function: SelectLocationButton
function SelectLocationButtonPushed(app, event)
Thiago Henrique Gomes Lobato on 31 May 2020
The problem is the userpath function. As stated in the error, you can't modify a matlab path in your deployed application, regardless of using isdeploy or not (this is actually only a value of 1 or 0). Try:
and remove the following line:
You may have to make some slightely changes for the path to be a full valid one, but besides this it should work.