this file consists of 6 columns: the the third,the fourth,the fifth and the sixth include values such as (99999,9) and (99,9900) ; these values i want to replace them by the following word (NAN) not a number.....please tell me the code for doing this...........the name of the file is space......the name of the third column is y3......the name of the fourth column is y4........the name of the fifth column is y5......the name of the sixth column is y6.. i hope you tell me the code for replacing 99999,9 and 99,9900 by NAN (not a number).
how i can replace (99999,9) and (99,9900) in a column by NAN?
조회 수: 1 (최근 30일)
이전 댓글 표시
this file consists of 6 columns: the the third,the fourth,the fifth and the sixth include values such as (99999,9) and (99,9900) ; these values i want to replace them by the following word (NAN) not a number.....please tell me the code for doing this...........the name of the file is space......the name of the third column is y3......the name of the fourth column is y4........the name of the fifth column is y5......the name of the sixth column is y6.. i hope you tell me the code for replacing 99999,9 and 99,9900 by NAN (not a number).
채택된 답변
Cris LaPierre
2020년 3월 26일
편집: Cris LaPierre
2020년 3월 26일
% Create a row vector and replace all instances of -99
% with the standard missing value for double data types, NaN.
A = [0 1 5 -99 8 3 4 -99 16];
B = standardizeMissing(A,-99)
댓글 수: 7
Cris LaPierre
2020년 3월 26일
You must be trimming the header lines out of your file. If I run that code on the space.txt file attached to this question, I get the following error message:
Error using load
Unable to read file 'space.txt'. Input must be a MAT-file or an ASCII file containing numeric data with same number of columns in each row.
Cris LaPierre
2020년 3월 26일
Once your data is in MATLAB, use standardizeMissing to replace the specified value with NaN. You'll need to do this for each variable. Here is the code for y3.
y3 = standardizeMissing(y3,99999.9);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!