How to call a file without extension?

조회 수: 31 (최근 30일)
Mario Martos
Mario Martos 2016년 5월 17일
댓글: Mario Martos 2016년 5월 24일
Hello, I wanted to ask about how you could call a Matlab file extension in name only , ie without the extension. For example, if I have a process or file " ejemplo.xml " , " ejemplo.wav " ... And I want to name , upload or read the file name "example" . For example , I want to process the following, using only the name "example" .
I have this file: " nombre.wav "
function res = function ( " name")
Or with a " audio.wav " file , use only the filename "audio" to create another name with that information.
Thanks in advanced.

채택된 답변

Adam
Adam 2016년 5월 17일
[pathstr,name,ext] = fileparts(filename);
breaks up a filename into component parts, including the name and the extension. I'm not really sure what you are asking, but if you get the 'name' part out of that then you can use this and it will be separated from the path and the extension.
  댓글 수: 5
Adam
Adam 2016년 5월 23일
[pathstr,name,ext] = fileparts(filename);
newFilename = fullfile( pathstr, name );
assuming you only have one extension which you do.
Mario Martos
Mario Martos 2016년 5월 24일
Thanks you very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by