Filename truncated in MATLAB

21 次查看(过去 30 天)
Deepayan Bhadra
Deepayan Bhadra 2020-5-19
回答: Sumukh 2024-9-17,8:44
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.

回答(1 个)

Sumukh
Sumukh 2024-9-17,8:44
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.

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by