MATLAB: Do i have a syntax error

syntex

I am trying to make a GUI code in order to upload a file: [name path]=uigetfile({'*.mp4'},'file select') i want to get the path name and the file name and store them in those variables the program underlines the [name path] in red and says that it must have comma between the two variables.

Best Answer

So put a comma. Or better yet, try it this way:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.mp4');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)