フィルターのクリア

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 Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by