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

조회 수: 2 (최근 30일)
bkshn
bkshn 2014년 5월 23일
답변: Azzi Abdelmalek 2014년 5월 23일
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?
I'll appreciate your help.
  댓글 수: 1
Henric Rydén
Henric Rydén 2014년 5월 23일
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?

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 23일
Your vector should be something like this
v={3;[] ;4;[];3;[];2;[];2;[];2}
You can add this code
for k=1:numel(v)
if isempty(v{k})
%do
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by