Auto-generated import data script does not run

조회 수: 1 (최근 30일)
Fernando Tomasel
Fernando Tomasel 2018년 5월 21일
댓글: Ameer Hamza 2018년 5월 22일
Hi,
I'm using the import tool to import some data. The import tool works just fine, but the automated script it generates (attached) throws an error that seems to be related to its syntax:
"Undefined function or variable 'raw'.
Error in Untitled2 (line 38)
rawStringColumns = string(raw(:, [1,2,3,4,5,6,7,8,9,10,11,12,13,14]));"
Can you please check and tell me what may be going on?
Thx!

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 21일
The file you attaches has a difference from the script file uiimport tool generate for automatically loading data from a general type of file. The file should have few lines before
numericData = NaN(size(dataArray{1},1),size(dataArray,2));
defining the raw variable. Are you sure you haven't accidentally deleted those lines? Try generating the script again.
  댓글 수: 2
Fernando Tomasel
Fernando Tomasel 2018년 5월 21일
편집: Walter Roberson 2018년 5월 21일
Thanks Ameer - I did generate the script again, but it came up exactly the same... however, prompted by your comment, I generated a script based on a second dataset, and that created the few extra lines I was missing:
raw = repmat({''},length(dataArray{1}),length(dataArray)-1);
for col=1:length(dataArray)-1
raw(1:length(dataArray{col}),col) = mat2cell(dataArray{col}, ones(length(dataArray{col}), 1));
end
The difference between the two datasets is that the first had tagged all columns with 'categorical' as data type, while the second set had one column tagged as 'text'. Somehow, the dataset that had all as categorical did not generate the extra lines of code.
Thanks!
Ameer Hamza
Ameer Hamza 2018년 5월 22일
That's true, I just tested and found this issue in R2017b that if all columns are categorical, these lines are skipped. This might some bug. R2018a produce a correct script file.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by