How can i plot a continuous graph with NaN in matlab?

I have an array of data as below:
1.0e+03 *
-0.0001 0.0033 0.0002 0.0000
NaN NaN NaN NaN
0.0032 0 NaN NaN
0.0033 0.0067 0.0002 0.0000
NaN NaN NaN NaN
0.0099 0 NaN NaN
0.0099 0.0067 0.0002 0.0000
NaN NaN NaN NaN
0.0165 0 NaN NaN
0.0166 0.0066 0.0001 0.0001
0.0232 0 NaN NaN
0.0232 0.0066 0.0001 0.0001
0.0298 0 NaN NaN
0.0299 0.0002 0.0001 0.0001
0.0300 0.0007 0.0001 0.0001
0.0307 0.0006 0.0001 0.0001
0.0319 0.0033 0.0001 0.0001
0.0352 0 NaN NaN
0.0352 0.0066 0.0001 0.0001
0.0418 0 NaN NaN
0.0419 0.0066 0.0001 0.0001
0.0485 0 NaN NaN
0.0485 0.0067 0.0002 0.0000
NaN NaN NaN NaN
0.0551 0 NaN NaN
I want to plot as follow:
subplot(2,1,1), plot(A(:,1),A(:,3));
subplot(2,1,2), plot(A(:,1),A(:,4));
The goal is to replace the NaN with the previous value. any help will be highly appreciated, thanks.

답변 (1개)

Thorsten
Thorsten 2016년 7월 15일
x = sum(mat, 2);
A = mat(~isnan(x), :);
subplot(2,1,1), plot(A(:,1),A(:,3));
subplot(2,1,2), plot(A(:,1),A(:,4));

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

질문:

2016년 7월 15일

답변:

2016년 7월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by