Cannot detect {1} from file: ''{0}''. Specify {2} when you create the datastore. Verify the Text Format and Advanced Tex

Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Cannot detect {1} from file: ''{0}''. Specify {2} when you create the datastore. Verify the Text Format and Advanced Tex

Post by matlab1 »

Cannot detect {1} from file: ''{0}''. Specify {2} when you create the datastore. Verify the Text Format and Advanced Text Format Properties
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Re: Cannot detect {1} from file: ''{0}''. Specify {2} when you create the datastore. Verify the Text Format and Advanced

Post by matlab1 »

Solution:


Advanced Text Format Properties

TextscanFormats — Data field format
cell array of character vectors | string array
Data field format, specified as a cell array of character vectors or a string array, where each character vector or string contains one conversion specifier.

When you specify or modify the TextscanFormats property, you can use the same conversion specifiers that the textscan function accepts for the formatSpec argument. Valid values for TextscanFormats include conversion specifiers that skip fields using an asterisk (*) character and ones that skip literal text. The number of conversion specifiers must match the number of variables in the VariableNames property.

If the value of TextscanFormats includes conversion specifiers that skip fields using asterisk characters (*), then the value of the SelectedVariableNames property automatically updates. MATLAB uses the %*q conversion specifier to skip fields omitted by the SelectedVariableNames property and treats the field contents as literal character vectors. For fixed-width files, indicate a skipped field using the appropriate conversion specifier along with the field width. For example, %*52c skips a field that contains 52 characters.

If you do not specify a value for TextscanFormats, then datastore determines the format of the data fields by scanning text from the first nonheader line in the first file of the datastore.

Starting in R2020b, datastore detects prefixed literals as hexadecimal and binary data. Previously, datastore detected prefixed literals as text data.

Example: {'%s','%s','%f'}

Data Types: cell | string

https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.tabulartextdatastore.html

For more information,
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests