Coastal-Imaging-Research-Network / CoastSnap-Toolbox

This repository contains code, documentation and discussion forum for the CoastSnap community beach monitoring network
30 stars 9 forks source link

Image load #6

Closed fed1942 closed 3 years ago

fed1942 commented 3 years ago

I having problems when load a image with previously saved shoreline (steps 1 to 5 completed; Matlab 2020). The error i got is:

Error using feval Not enough input arguments.

Error in sl (line 15) [varargout{1:nargout}]=feval(varargin{:});

Error in CSPGloadImage (line 77) if isfield(sl,'QA')&&sl.QA==0

Error in CSP>loadimage_Callback (line 103) CSPGloadImage(handles);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in CSP (line 42) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)CSP('loadimage_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

mitchharley commented 3 years ago

The error looks like you have a function somewhere in your matlab environment called sl (type "which sl" to find this). If you remove this function from your matlab path, the error should go away

fed1942 commented 3 years ago

I removed the function sl from the matlab environment by using the next piece of code:

rmpath('C:\Program Files\MATLAB\R2020a\toolbox\simulink\simulink')

rmpath remove folders from search path. The 'simulink' folder contains the sl.m function file.

Now, when i try to load a image with previously saved shoreline, i get the following error:

Unrecognized function or variable 'sl'.

Error in CSPGloadImage (line 77) if isfield(sl,'QA')&&sl.QA==0

Error in CSP>loadimage_Callback (line 103) CSPGloadImage(handles);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in CSP (line 42) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)CSP('loadimage_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

mitchharley commented 3 years ago

I dont have a solution for this, but it might be related to Matlab getting confused with the simulink sl function when trying to save your shoreline. Is there a saved shoreline in the CoastSnap/Shoreline directory? If so, try and loading it manually in Matlab and see if it has the variable sl (it should).

fed1942 commented 3 years ago

There is a saved shoreline in the CoastSnap/Shoreline directory, and it has the sl variable. Inside, there are the coordinates for the shoreline position. What i dont understand is why in the CoastSnap Workshop videos you can load the images (with a saved shoreline) without problem and i cant. What is the difference?

mitchharley commented 3 years ago

I think by removing the path, you cause different issues because that is a very important path. I was able to replicate the error and create a work-around. Please pull the latest version from github and the problem should be fixed

fed1942 commented 3 years ago

The problem was fixed. Thank you very much.