How do I replace data in a dataset?

조회 수: 9 (최근 30일)
Jordan
Jordan 2012년 8월 14일
I'm using a dataset that I generated from the output of a lab mate's code, and all of the "no data" values are currently listed as -1. I want to change all of the -1 values to NaN so that I can start to run stats on the data. Is there a way that I can do this? The variables in question are doubles (so I can't use strrep), but my dataset also has other variable types.

채택된 답변

Matt Fig
Matt Fig 2012년 8월 14일
Dat = [-1 2 3 4 5 6 -1 4.3 pi -1]
Dat(Dat==-1) = nan
  댓글 수: 1
Jordan
Jordan 2012년 8월 14일
Thank you! You are a life saver! (or at least a Tuesday-saver)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by