필터 지우기
필터 지우기

How to Use Edit Text in GUI in creating a filename?

조회 수: 2 (최근 30일)
Meera
Meera 2015년 4월 7일
댓글: Meera 2015년 4월 8일
Hello Guys,
My problem is how to create a filename through editText in GUI?
t1=str2double(get(handles.Start_Time, 'string')); t2=str2double(get(handles.End_Time, 'string'));
I would like to use these t1 and t2 values in creating a text file name as below
repot_path = fullfile(pathname,'\','TimeSignal_of_' t1 'sec_to_' t2 'sec''.txt');
% finally file name should be like 'TimeSignal_of_3sec_to_4sec.txt'
dlmwrite(repot_path,Data_TBP,'precision', '%.4f','newline','pc');
but I am getting an error.
Kindly please help me.
With Regards; Meera Kunden
  댓글 수: 1
Adam
Adam 2015년 4월 7일
편집: Adam 2015년 4월 7일
Please format your code in a {} Code block and include any error messages you receive. It takes a lot more effort for us to read through unformatted code and then to find all you say at the end if "I am getting an error".
You shouldn't need to be putting '\' as an argument to fullfile though - one of the purposes of that function is to add in file separators specific to the machine in question.

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

답변 (1개)

Ilham Hardy
Ilham Hardy 2015년 4월 7일
repot_path = fullfile(pathname,['TimeSignal_of_' t1 'sec_to_' t2 'sec''.txt']);
Or
repot_path = [pathname '\TimeSignal_of_' t1 'sec_to_' t2 'sec''.txt'];
  댓글 수: 4
Ilham Hardy
Ilham Hardy 2015년 4월 7일
Adam: +1, I didn't notice the str2double part. Thanks.
Meera
Meera 2015년 4월 8일
Hello Adam & Hardy,
Thank you very much. I got the correct output.
Adam - Thank you for correcting my mistakes in posting the questions.

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

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by