node creation using for loop

조회 수: 3 (최근 30일)
Shahrukh s
Shahrukh s 2020년 9월 10일
댓글: KSSV 2020년 9월 10일
how can we create nodeset having data like node_number, x,y,z coordinates say for 20 nodes using for loop
  댓글 수: 6
Shahrukh s
Shahrukh s 2020년 9월 10일
i just want a for loop programme to execute this type data structure
KSSV
KSSV 2020년 9월 10일
x = 100:120 ;
y =10:20 ;
[X,Y] = meshgrid(x,y) ;
mesh(X,Y)

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

답변 (2개)

KSSV
KSSV 2020년 9월 10일

Ameer Hamza
Ameer Hamza 2020년 9월 10일
Try using graph() object provided by MATLAB: https://www.mathworks.com/help/releases/R2020a/matlab/ref/graph.html. For example,
node_ID = string(1:20);
x = rand(20,1);
y = rand(20,1);
z = rand(20,1);
G = graph(zeros(20), node_ID);
G.Nodes.x = x;
G.Nodes.y = y;
G.Nodes.z = z;
plot(G)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by