Filename truncated in MATLAB

14 views (last 30 days)
Deepayan Bhadra
Deepayan Bhadra on 19 May 2020
Answered: Sumukh on 17 Sep 2024
I am using a command:
[TestDefinitionFiles,testDefinitionFolder] = uigetfile('*.xlsx','Select one or more test definitions that you to execute','MultiSelect','on');
When I load the excel file (Disabled_to_MoveMotor), I see it in TestDefinitionFiles as
Why is the name truncated or is anything wrong from the user's side?
Thanks.

Answers (1)

Sumukh
Sumukh on 17 Sep 2024
Hi Deepayan,
The truncated filename in the image is in the 8.3 short filename format. This is a format of filename that is used in older file systems that have a limitation on file name length, like FAT16 or FAT32.
  • One possible reason for the truncation is that MATLAB may retrieve the short name of the Excel file if the file is located on a drive that uses such a file system. You can investigate in the Microsoft community to check whether upgrading to a newer file system like NTFS is possible, where this restriction is absent.
  • Another possible reason for the truncation is if the “NTFSDisable8dot3NameCreation” setting is enabled on Windows. You can run the following command on the MATLAB command window to check if the setting is enabled or disabled:
! fsutil behavior query disable8dot3
If the registry value is 0, it means that the 8.3 name creation is enabled. You can disable this setting by referring to the following link from Microsoft:
I am unable to reproduce the truncation issue in MATLAB R2018b, as the file system I am using is NTFS for Windows.
  • A possible workaround to get the file name is to manually type in the excel file name.
  • An alternative workaround to the “uigetfile” command is the “dir” command. This command can be used to get the names of the .XLSX files in the current working directory using the wildcard “*.xlsx”. You can run the following command in the MATLAB command window to know more about the “dir” command:
web(fullfile(docroot, 'matlab/ref/dir.html'))
I hope this helps resolve your issue.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!