Complete the code to join folder and file name into a full path.
fullPath = fullfile([1], 'data.txt');
The fullfile function joins folder and file names into a full path. Here, folderName is the folder part.
Complete the code to extract the file extension from a file path.
[~, ~, [1]] = fileparts(filePath);The fileparts function returns the folder, file name, and extension. The third output is the file extension.
Fix the error in the code to check if a path is a folder.
if isfolder([1]) disp('It is a folder.'); end
The isfolder function checks if the input is a folder path. Use the variable that stores the folder path.
Fill both blanks to create a path and check if it exists.
fullPath = fullfile([1], [2]); if exist(fullPath, 'file') disp('File exists.'); end
fullfile.Use folderName and fileName to build the full path. Then exist checks if the file exists.
Fill all three blanks to split a path and rebuild it with a new extension.
[folder, name, [1]] = fileparts(oldPath); newPath = fullfile(folder, [name [2] [3]]);
'/' instead of dot '.' for extension separator.Extract the extension with extension. Then rebuild the file name by joining name, a dot '.', and the new extension 'txt'.