MATLAB Answers

Variable file path for importdata

조회 수: 102(최근 30일)
I am unsure why the following code does not work:
str = input('Enter the filename: ', 's');
bottom_temp = fullfile('Temperatures','Bottom',str,'.txt');
BOT_TEMP = importdata(bottom_temp);
But this code does work:
BOT_TEMP = importdata('Temperatures\Bottom\str.txt');
% where str is the name of the file
The first set of code returns: 'Unable to open file'
I have a feeling that there is some simple formatting error that I am overlooking, any help would be appreciated.

  댓글 수: 0

로그인 to comment.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 9 May 2013
bottom_temp = fullfile('Temperatures','Bottom',[str,'.txt'])

  댓글 수: 0

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by