Info

This question is closed. Reopen it to edit or answer.

Hi, Guyz i need a help, i have an array that contain both zero and non-zero elemnts ,but i want to plot only non-zero elements without deleting zeros?

1 view (last 30 days)
Hi, Guyz i need a help, i have an array that contain both zero and non-zero elemnts ,but i want to plot only non-zero elements without deleting zeros?

Answers (1)

KSSV
KSSV on 5 Dec 2016
idx = length(data);
plot(idx(data~=0),data(data~=0))
where data is your array.

Community Treasure Hunt

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

Start Hunting!