필터 지우기
필터 지우기

Undefined function or variable 'fixedWidt​hImportOpt​ions'.

조회 수: 1 (최근 30일)
Rod Letchford
Rod Letchford 2019년 2월 23일
댓글: Rod Letchford 2019년 2월 24일
I get the following error message whenever I try to use the object 'fixedWidthImportOptions':
" Undefined function or variable 'fixedWidthImportOptions'. "
I am using Matlab R2018a. The object was introduced with R2017a. What is wrong and what can I do to remedy this?

답변 (1개)

Star Strider
Star Strider 2019년 2월 23일
It’s an options structure to be used with the readtable (link) function. See the documentation section on Examples (link).
How are you using it?
  댓글 수: 2
Rod Letchford
Rod Letchford 2019년 2월 23일
Star Strider: I am trying to use it to read data from a text file with sections in fixed column width, and mixed data (double and strings) as in another question of mine. I've tried readtable, textscan and others I can't remember. It is strangely complicated.
Rod Letchford
Rod Letchford 2019년 2월 24일
It looks like I was using the wrong syntax for FixedWidthImportOptions. I was using this syntax:
opts = fixedWidthImportOptions('NumVariables',NumVariables,...
'DataLines',DataStartLine,...
'VariableNames',VariableNames,...
'VariableWidths',VariableWidths,...
'VariableTypes',DataType);
for readtable, where I should have used something like:
opts = matlab.io.text.FixedWidthImportOptions;
opts.DataLines = DataStartLine;
opts.VariableNames = VariableNames;
opts.VariableWidths = VariableWidths;
opts = setvartype(opts,DataType);
It is far from clear that this is the case nor why.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by