Why is trailing back space removed from my folder name?
I have a subfolder named .results (I give the whole name)
Allowing the user to change it I have name app.defOutLoc as default and the app.OutLoc once confirmed.
app.OutLoc = app.defOutLoc;
K>> defOutLoc
defOutLoc =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
K>> app.OutLoc
ans =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
So when I add the folder name to file name I end up saving resultsMyFileName.txt in the parent folder
Who asked you to trim my ? and what do I do now?
I’ve added at some points
% Don’t forget the ending
app.OutLoc = append(app.OutLoc,"");
but now need to chase down every time I do an assignment and add it back!
You would think it could at least be done right here where I build the name:
app.StartSessionTime = …
char(datetime(‘now’,’Format’,"_yyMMdd_HHmmss"));
baseFileName = append(app.MouseName.Value, …
app.StartSessionTime);
app.SessionFileName = append(app.OutLoc, …
"MC_",baseFileName,"_session.m");
app.SessionFile = fopen(app.SessionFileName,’at’); % allow appending
I suppose there is some special way to combine file parts instead of append where ML put it back that I missed.
OK I found fullfile() Now to get it to properly put all the pieces together. Like this?
app.SessionFileName = fullfile(app.OutLoc, append("MC_",baseFileName,"_session"),"m";I have a subfolder named .results (I give the whole name)
Allowing the user to change it I have name app.defOutLoc as default and the app.OutLoc once confirmed.
app.OutLoc = app.defOutLoc;
K>> defOutLoc
defOutLoc =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
K>> app.OutLoc
ans =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
So when I add the folder name to file name I end up saving resultsMyFileName.txt in the parent folder
Who asked you to trim my ? and what do I do now?
I’ve added at some points
% Don’t forget the ending
app.OutLoc = append(app.OutLoc,"");
but now need to chase down every time I do an assignment and add it back!
You would think it could at least be done right here where I build the name:
app.StartSessionTime = …
char(datetime(‘now’,’Format’,"_yyMMdd_HHmmss"));
baseFileName = append(app.MouseName.Value, …
app.StartSessionTime);
app.SessionFileName = append(app.OutLoc, …
"MC_",baseFileName,"_session.m");
app.SessionFile = fopen(app.SessionFileName,’at’); % allow appending
I suppose there is some special way to combine file parts instead of append where ML put it back that I missed.
OK I found fullfile() Now to get it to properly put all the pieces together. Like this?
app.SessionFileName = fullfile(app.OutLoc, append("MC_",baseFileName,"_session"),"m"; I have a subfolder named .results (I give the whole name)
Allowing the user to change it I have name app.defOutLoc as default and the app.OutLoc once confirmed.
app.OutLoc = app.defOutLoc;
K>> defOutLoc
defOutLoc =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
K>> app.OutLoc
ans =
"C:UsersCPSLabDocumentsOdorChoiceDevresults"
So when I add the folder name to file name I end up saving resultsMyFileName.txt in the parent folder
Who asked you to trim my ? and what do I do now?
I’ve added at some points
% Don’t forget the ending
app.OutLoc = append(app.OutLoc,"");
but now need to chase down every time I do an assignment and add it back!
You would think it could at least be done right here where I build the name:
app.StartSessionTime = …
char(datetime(‘now’,’Format’,"_yyMMdd_HHmmss"));
baseFileName = append(app.MouseName.Value, …
app.StartSessionTime);
app.SessionFileName = append(app.OutLoc, …
"MC_",baseFileName,"_session.m");
app.SessionFile = fopen(app.SessionFileName,’at’); % allow appending
I suppose there is some special way to combine file parts instead of append where ML put it back that I missed.
OK I found fullfile() Now to get it to properly put all the pieces together. Like this?
app.SessionFileName = fullfile(app.OutLoc, append("MC_",baseFileName,"_session"),"m"; folderfile name MATLAB Answers — New Questions