removing data from a large matrix

1 Ansicht (letzte 30 Tage)
Rumaanah Khan
Rumaanah Khan am 17 Mär. 2020
Beantwortet: Hiro Yoshino am 17 Mär. 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 Kommentare
KSSV
KSSV am 17 Mär. 2020
How is your matrix? In mat file? What class it is?
Guillaume
Guillaume am 17 Mär. 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 '[]').

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Hiro Yoshino
Hiro Yoshino am 17 Mär. 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.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by