필터 지우기
필터 지우기

Variable as placeholder in an "fopen" statement

조회 수: 5 (최근 30일)
Reuben Addison
Reuben Addison 2023년 2월 8일
편집: Stephen23 2023년 2월 9일
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
Stephen23
Stephen23 2023년 2월 8일
편집: Stephen23 2023년 2월 9일
"I know typically it goes into the braces..."
"...but this time arround it is not working"
which is not a big surprise with MATLAB.

댓글을 달려면 로그인하십시오.

채택된 답변

Les Beckham
Les Beckham 2023년 2월 8일
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));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by