Filename truncated in MATLAB

13 vues (au cours des 30 derniers jours)
Deepayan Bhadra
Deepayan Bhadra le 19 Mai 2020
Réponse apportée : Sumukh le 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.

Réponses (1)

Sumukh
Sumukh le 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.

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by