How can I fill empty elements in a vector to preserve conjunction ?

2 visualizzazioni (ultimi 30 giorni)
bkshn il 23 Mag 2014
Risposto: Azzi Abdelmalek il 23 Mag 2014
HEllo
I have a vector for example with 10 rows and one column(10*1).
The elemets of my vector every other row are empty. like [3; ;4; ;3; ;2; ;2; ;2].
I should say the vector is a path on an image from top to bottom, and element are number of column.
in fact the vector show that there is the path that in first row goes from column 3
in second row goes from column -
in third row goes from column4
How can I fill the empty element that I could have conjunction in this path?
1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Henric Rydén il 23 Mag 2014
You say that you have a vector with ten elements, but [3; ;4; ;3; ;2; ;2; ;2] has only six elements. Can you clarify this?

Accedi per commentare.

Risposta accettata

Azzi Abdelmalek il 23 Mag 2014
Your vector should be something like this
v={3;[] ;4;[];3;[];2;[];2;[];2}
for k=1:numel(v)
if isempty(v{k})
%do
end
end
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by