Filter löschen
Filter löschen

Variable as placeholder in an "fopen" statement

5 Ansichten (letzte 30 Tage)
Reuben Addison
Reuben Addison am 8 Feb. 2023
Bearbeitet: Stephen23 am 9 Feb. 2023
Still on the issue of a place holder , I am trying to write a code to name the output folder by subject name, I know typically it goes into the braces but this time arround it is not working
''
subject = "PO1"
fid = fopen(['/Users/addison/Documents/Data/"Results2"+{subject}.xls'],'w');
''
  1 Kommentar
Stephen23
Stephen23 am 8 Feb. 2023
Bearbeitet: Stephen23 am 9 Feb. 2023
"I know typically it goes into the braces..."
"...but this time arround it is not working"
which is not a big surprise with MATLAB.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Les Beckham
Les Beckham am 8 Feb. 2023
The way I would do this is this
subject = "PO1";
folder = "/Users/addison/Documents/Data/";
filename = "Results2" + subject + ".xls"
filename = "Results2PO1.xls"
fid = fopen(fullfile(folder, filename));

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by