Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to take part of a filename

Subject: How to take part of a filename

From: Camille Couzi

Date: 18 Oct, 2010 17:07:03

Message: 1 of 3

Hi,
I am selecting a file using the uigetfil command
[h.file_mat,h.path_mat]=uigetfile('*.mat')

then the answer is for example
h.file_mat='example.mat'

Now I want to delete the '.mat' part, ie I want to get the filename without the extension, ie I need a command, so that I get 'example' as an answer

Can somebody help me? I would be really greatful

Camille.

Subject: How to take part of a filename

From: Pekka Kumpulainen

Date: 18 Oct, 2010 17:15:07

Message: 2 of 3

"Camille Couzi" <camillecouzi@yahoo.fr> wrote in message <i9hurn$iss$1@fred.mathworks.com>...
> Hi,
> I am selecting a file using the uigetfil command
> [h.file_mat,h.path_mat]=uigetfile('*.mat')
>
> then the answer is for example
> h.file_mat='example.mat'
>
> Now I want to delete the '.mat' part, ie I want to get the filename without the extension, ie I need a command, so that I get 'example' as an answer
>
> Can somebody help me? I would be really greatful
>
> Camille.

doc fileparts:
[pathstr, name, ext] = fileparts(filename)

Subject: How to take part of a filename

From: Camille Couzi

Date: 18 Oct, 2010 18:03:04

Message: 3 of 3

Thanks a lot Pekka!!!!


"Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <i9hvaq$ja9$1@fred.mathworks.com>...
> "Camille Couzi" <camillecouzi@yahoo.fr> wrote in message <i9hurn$iss$1@fred.mathworks.com>...
> > Hi,
> > I am selecting a file using the uigetfil command
> > [h.file_mat,h.path_mat]=uigetfile('*.mat')
> >
> > then the answer is for example
> > h.file_mat='example.mat'
> >
> > Now I want to delete the '.mat' part, ie I want to get the filename without the extension, ie I need a command, so that I get 'example' as an answer
> >
> > Can somebody help me? I would be really greatful
> >
> > Camille.
>
> doc fileparts:
> [pathstr, name, ext] = fileparts(filename)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us