How can i plot a continuous graph with NaN in matlab?
Afficher commentaires plus anciens
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.
Réponses (1)
Thorsten
le 15 Juil 2016
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));
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!