필터 지우기
필터 지우기

How to insert a string into a sprint?

조회 수: 7 (최근 30일)
JOJO
JOJO 2013년 12월 22일
댓글: Image Analyst 2013년 12월 23일
I want the input stored into name be displayed in the %s. How can I do it? it is possible?
name = input ('Enter the name of the voice command');
file = sprintf('%s.wav','name'); %name the sound file to be created

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 22일
name = input ('Enter the name of the voice command','s');
file = sprintf('%s.wav',name);

추가 답변 (1개)

Image Analyst
Image Analyst 2013년 12월 22일
Try this more user friendly and robust way to "get the name of the sound file to be created":
% Ask user for the name of the file to be created.
[baseFileName, folder] = uiputfile('*.wav', 'Enter the file name of the voice command to be created')
% Create the full file name with the folder prepended.
% .wav will be automatically appended regardless
% if they did or did not enter an extension.
fullFileName = fullfile(folder, baseFileName)
  댓글 수: 1
Image Analyst
Image Analyst 2013년 12월 23일
By the way, Walter already suggested that you use fullfile in this answer to your previous question

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

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by