removing data from a large matrix
2 ビュー (過去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277652/image.png)
2 件のコメント
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
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277705/image.png)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!