Generating numbers to replace missing values in a column vector
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi
I have a column vector has 60 values placing in order from small to large numbers, however some of these values are missing (has Zero values) I want to generate some values to replace these zeros in the missing cells within the order of the other numbers (non missing numbers) in the vector.
For example:
my vector is A:
A= [0.58; 0; 0; 0; 1.06; 0; 0; 0; 0; 2.47; 0;
0; 0; 0; 5.16; 0; 0; 0; 0; 10.94; 0; 0; 0; 0; 22.25;
0; 0; 0; 0; 42.82; 0; 0; 0; 0; 66.60; 0; 0; 0; 0; 93.45;
0; 0; 0; 0; 119.43; 0; 0; 0; 0; 183.43; 0; 0; 0; 0; 248.94;
0; 0; 0; 0; 320.76];
So, the values to be generated for repalcing the zeros in cells A(1, 2:4) should be in order between the valuse 0.58 and 1.06, and the same for the other zeros.
Hopefully I have explained the question in a clear way, and thanks in advance for helping me.
Regards
댓글 수: 0
채택된 답변
Walter Roberson
2021년 4월 1일
A= [0.58; 0; 0; 0; 1.06; 0; 0; 0; 0; 2.47; 0;
0; 0; 0; 5.16; 0; 0; 0; 0; 10.94; 0; 0; 0; 0; 22.25;
0; 0; 0; 0; 42.82; 0; 0; 0; 0; 66.60; 0; 0; 0; 0; 93.45;
0; 0; 0; 0; 119.43; 0; 0; 0; 0; 183.43; 0; 0; 0; 0; 248.94;
0; 0; 0; 0; 320.76];
B = fillmissing(standardizeMissing(A, 0),'linear')
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!