Info

This question is closed. Reopen it to edit or answer.

i dont know how

1 view (last 30 days)
basma salim
basma salim on 23 May 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
i have table with missing value i import it to command window my question is how can i select just the compleat data without missing one to applay k means cluster ony one advise me please
  1 Comment
Image Analyst
Image Analyst on 23 May 2015
What do you mean by "missing"? Is the value a nan? Or is it null or empty, []? What does "import it to command window" mean? You send things to the command window, or print them there, or your code can put results there if you leave off the semicolon. Not sure how "import" applies to the command window.
What does the MATLAB Compiler have to do with this? Did you mean to add the Statistic and Machine Learning Toolbox, which is where kmeans is? And if so, why can't you just send whatever data you do have to kmeans()?

Answers (1)

Walter Roberson
Walter Roberson on 23 May 2015
If you have an array of numeric values in which missing values show up as NaN, and if you want to skip any row that contains a NaN, then use
NewArray = YourArray(~any(isnan(YourArray),2),:);
If you want to process by columns instead of by rows then
NewArray = YourArray(:,~any(isnan(YourArray),1));

Products

Community Treasure Hunt

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

Start Hunting!