Can detectImportOptions automatically return the fixedWidthImportOptions?
14 ビュー (過去 30 日間)
古いコメントを表示
I have many text data to be imported in MATLAB.
But when I use T = readtable(filename,opts) and opts = detectImportOptionsdetectImportOptions(filename), the opts always return a DelimitedTextImportOptions, while what I needed is fixedWidthImportOptions.
Is there any method to return fixedWidthImportOptions by the function detectImportOptions before each text data be readed.
I cannot specify the format of fixedWidthImportOptions since every text data has different variable width.
2 件のコメント
Sharannya Ranjith
2019 年 4 月 10 日
There are two ways of generating a 'fixedWidthImportOptions': through the generic constructor (which would require to manually populate the options), or through 'detectImportOptions'. There is no way to force 'detectImportOptions' to return the fixedWidthImportOptions'. You may want to generate IO functions via the import tool if you need to restrict the mannerism.
Stephen23
2025 年 11 月 26 日
"Is there any method to return fixedWidthImportOptions by the function detectImportOptions before each text data be readed."
Yes: specify the FileType option as 'fixedwidth': https://www.mathworks.com/help/matlab/ref/detectimportoptions.html#namevaluepairs
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!