Hello,
Looking help in saving same .mat file with prefix over loop.
Facing error with following script:
clear allclose alld = uigetdir();filePattern = fullfile(d, '*.mat');file = dir(filePattern);for k = 1: numel(file) baseFileName = file(k).name; fullFileName = fullfile(d, baseFileName); % my code here
outputBaseFileName = sprintf('Edited_%s', baseFileName); outputFullFileName = fullfile(file(k).folder, outputBaseFileName); save(outputFullFileName,'Variable_1','-append');end
Error I am getting is:
Error using saveUnable to write file 'myPath\Edited_myFileName.mat'No such file or directory.Error in Untitled (line 29)save(outputFullFileName,'Variable_1','-append');
Best Answer