필터 지우기
필터 지우기

Rename dataset variable

조회 수: 3 (최근 30일)
Mark
Mark 2012년 2월 22일
편집: Cedric 2013년 10월 21일
I am trying to rename a field in a dataset, but I get an error:
>> someDS.Properties.VarNames{3} = 'NEWNAME';
??? Error using ==> dataset.subsasgn at 418
Duplicate variable names.
No, there is no other variable with the same name I'm trying to assign!
What am I doing wrong?
Thanks
  댓글 수: 3
Mark
Mark 2012년 2월 23일
What I can tell you is that "someDS" was created using the "join" function. The resulting dataset had no duplicate variable names. In fact, you can use any (valid) name you can think of on the right-hand side and you will get the same error.
I was able to fix the problem using a different approach, though. Before using "join" I assign names to the VariableNames of each of the dataset variables that I am joining (using the exact syntax above!!). The joined dataset has the VariableNames I want.
Regarding your question: "What is returned ... from someDS.Properties.VarNames". A cell array of strings containing the variable names in the dataset
Oleg Komarov
Oleg Komarov 2012년 2월 23일
I cannot reproduce the problem. Please post the complete code with a minimal working example which causes the error. Also, post the MATLAB version and OS.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by