removing data from a large matrix

6 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by