I have this: try if strcmp(dataDec.filename(end-3:end),saveSuffixe1(1:4))…
- User
I have 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 err err.message msgbox(['Save of ' dataDec.filename ' has failed !!'],'Warning','warn') display('Enregistrement chou !!') end witch erros Argument must be a text scalar on the save function. This only happens when I added a \ at the end of dataDec.pathname becouse I want to save in it's interior. RIght now it saves outside
- Assistant
The issue you're encountering seems to be related to how the path concatenation is happening with the
savefunction in MATLAB. The error message "Argument must be a text scalar" typically indicates that the filename or path being constructed and passed to thesavefunction is not a valid text string, possibly due to how the backslash is used or handled. - User
this is how it get's path export_path = uigetdir([],"Choose Directory to Export"); export_path = export_path + "";
- Assistant
- User
I can't do that, I only can modify export_path
- Assistant
If you're restricted from making changes to the core logic beyond
export_path, you can still ensure thatexport_pathis correctly formatted to work with your existing code. Here's how you can modify justexport_pathafter usinguigetdir:-
Ensure Correct Path Separator: Depending on your operating system, you can standardize the path by replacing custom concatenation and appending or checking for path separators properly.
-
Manipulate
export_path: Instead of using+ "\", ensure you're using MATLAB's consistent way of handling paths, which considers your platform.
-