How do I continue this loop?

3 ビュー (過去 30 日間)
Jack
Jack 2015 年 3 月 3 日
コメント済み: Geoff Hayes 2015 年 3 月 3 日
connectivity=zeros(hel+vel,2);
ielem=0;
for i=1:vd+1
for j=1:hd
ielem = ielem+1;
node_left=(hd+1)*(i-1)+j;
node_right=node_left+1;
connectivity(ielem,1)=node_left;
connectivity(ielem,2)=node_right;
end
end
for i=hd+1
for j =1:vd
ielem=ielem +1;
node_down=(vd+1)*(j-1)+i;
node_up=node_down + (hd+1);
connectivity(ielem,1)=node_down;
connectivity(ielem,2)=node_up;
end
end
It is returning a matrix with the second half of the matrix only returning zeros. I can only see that there is a problem with he second loop but I am having trouble spotting it. Any help would be amazing.
Thanks.
  1 件のコメント
Geoff Hayes
Geoff Hayes 2015 年 3 月 3 日
Jack - please include all relevant code. What are the values for hd and vd and how are they related to hel and vel? Which matrix has the second half of the matrix only returning zeros? Is it connectivity?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by