Variable as placeholder in an "fopen" statement
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Reuben Addison
el 8 de Feb. de 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 comentario
Stephen23
el 8 de Feb. de 2023
Editada: Stephen23
el 9 de Feb. de 2023
"I know typically it goes into the braces..."
with Python's Formatted String Literals: https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings
"...but this time arround it is not working"
which is not a big surprise with MATLAB.
Respuesta aceptada
Les Beckham
el 8 de Feb. de 2023
The way I would do this is this
subject = "PO1";
folder = "/Users/addison/Documents/Data/";
filename = "Results2" + subject + ".xls"
fid = fopen(fullfile(folder, filename));
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Large Files and Big Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!