how to change the displayed filename

I tried making a GUI where MatLab runs a script on a directory from a certain path, when showing the directory being used is there any way to show just the file name excluding the path i.e. *.ds, and when showing where the file is being saved, and what the path is to get the file, is there any way to show just the path excluding the file name i.e. D1/D2/D3 without the *.ds

Answers (1)

Use the fileparts() function to get the parts of the filename. Use sprintf() to build up any string that you want to display, and use set() to send that string to any static text or other control on your GUI.

Categories

Asked:

on 3 Jul 2013

Community Treasure Hunt

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

Start Hunting!