필터 지우기
필터 지우기

How use fillmissing on a string array

조회 수: 6 (최근 30일)
Brent
Brent 2017년 7월 28일
편집: Walter Roberson 2017년 7월 29일
Hi, Keep getting errors with:
full_table = fillmissing(full_table,'constant','---');
where full_table is a string array with missing elements. Online help shows lots of examples for numbers but none for strings but it says it should work for strings. Thank you!
  댓글 수: 1
per isakson
per isakson 2017년 7월 28일
string array Provide a small example of a string array with missing values.

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

답변 (1개)

Michael Doxey
Michael Doxey 2017년 7월 28일
편집: Michael Doxey 2017년 7월 28일
Hi Brent,
I understand that you are trying to use the fillmissing function, but you are experiencing issues when attempting to use it on an array of strings.
It seems that you are attempting to use a constant with more than one character, which could be why you are getting errors (such as: Fill constant must be a scalar). I have attached working code below that shows how to utilize this function with the constant method on strings. Hope I could be of help.
A = ['a' ' ' 'b' ' ' 'c'];
F = fillmissing(A, 'constant', '-')
F =
'a-b-c'
From the documentation: v can only be a vector is A is a matrix or a multidimensional array.
  댓글 수: 1
Brent
Brent 2017년 7월 29일
편집: Walter Roberson 2017년 7월 29일
I was able to resolve the issue, thank you for looking into it.
Didn't work:
full_table = fillmissing(full_table,'constant','---');
Did work:
full_table = fillmissing(full_table,'constant',"---");

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

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by