For some reason this try if strcmp(dataDec.filename(end-3:end),saveSuffixe1(1:4))…
- User
For some reason this try if strcmp(dataDec.filename(end-3:end),saveSuffixe1(1:4)) || strcmp(dataDec.filename(end-7:end),saveSuffixe1) save([dataDec.pathname dataDec.filename],'dataDec'); else save([dataDec.pathname savePrefixe1 dataDec.filename saveSuffixe1],'dataDec'); end catch msgbox(['Save of ' dataDec.filename ' has failed !!'],'Warning','warn') display('Enregistrement chou !!') end goes to the catch when dataDec.pathname has an \ at the end added by me. Why is that
- Assistant
The issue you're encountering is likely due to the way MATLAB handles file paths and the use of backslashes (
\) in strings. In MATLAB, the backslash character is used as an escape character, similar to many other programming languages. This means that when you want to use an actual backslash in a path, you either need to escape it or use forward slashes (/) instead.Here's what's likely happening:
- When you append a backslash at the end of
dataDec.pathname, it might be interpreted as an escape character if not doubled. For example, alone is fine, but if it ends with a single , MATLAB might interpret a subsequent character as a special character, which could lead to incorrect path formation.
- When you append a backslash at the end of
- User
'Argument must be a text scalar.'
- Assistant