removing data from a large matrix

1 vue (au cours des 30 derniers jours)
Rumaanah Khan
Rumaanah Khan le 17 Mar 2020
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 commentaires
KSSV
KSSV le 17 Mar 2020
How is your matrix? In mat file? What class it is?
Guillaume
Guillaume le 17 Mar 2020
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 '[]').

Connectez-vous pour commenter.

Réponses (1)

Hiro Yoshino
Hiro Yoshino le 17 Mar 2020
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.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by