TextscanFormats cannot contain only format specifiers that skip fields using an asterisk

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

TextscanFormats cannot contain only format specifiers that skip fields using an asterisk

Post by matlab1 »

TextscanFormats cannot contain only format specifiers that skip fields using an asterisk
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Re: TextscanFormats cannot contain only format specifiers that skip fields using an asterisk

Post by matlab1 »

Solution:


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'}

For more information,
https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.tabulartextdatastore.html
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests