removing data from a large matrix

4 ビュー (過去 30 日間)
Rumaanah Khan
Rumaanah Khan 2020 年 3 月 17 日
回答済み: Hiro Yoshino 2020 年 3 月 17 日
hi all
I have a very large matrix that contains number elements as well as '<missing>' elements. I want to remove these '<missing>' elements by assigning blanks '[ ]' wherever it appears in the matrix. How should I proceed ?, do i do this manually by going to each matrix location where it appears and assigning it the blank or do I use a loop ? If so , how ?
thanks
  2 件のコメント
KSSV
KSSV 2020 年 3 月 17 日
How is your matrix? In mat file? What class it is?
Guillaume
Guillaume 2020 年 3 月 17 日
It's clearly of class string. The double quotes " and the <missing> indicator are typical of string arrays.
So, "I have a very large matrix that contains number" is not true. The matrix contains text, the text may represent numbers but at the moment it's not numbers.
Why aren't the numbers stored as numbers? If the matrix is very large, storing the numbers as text is very innefficient memory-wise.
Note that the <missing> does not have enclosing quotes (double or single). It's very different from the text '<missing>' or "<missing>". <missing> indicates that the element is empty for a string array. Replacing that by the string "[]" would be a mistake.
So, please clarify what you're trying to do, and please use proper notation to avoid ambiguity. Elements of a string array are enclosed in double quote. And there's a very big difference between plain [] and the string "[]" (or char vector '[]').

サインインしてコメントする。

回答 (1 件)

Hiro Yoshino
Hiro Yoshino 2020 年 3 月 17 日
This page is a good fit for you.
In MATLAB, there are lots of preprocessing functions available.
I would suggest you may want to use rmmissing.
The easiest way to play around these pre-processing function is using them via LiveEditor - you can use them intuitively.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by