if and else statement

i have points value of pf =160801x1 (400x400 grid)
my plan is to devide each point into cell that consist of 4 nodes
using the script
n=nan(160000,1);
for x=1:160000
if (1<=x) & (x<=400)
kn(x,:)=1/4*(pf(x,1)+pf(x+1,1)+pf(801-x,1)+pf(802-x,1));
elseif x<=800
kn(x,:)=1/4*(pf(1202-x,1)+pf(1201-x,1)+pf(1602-x,1)+pf(1603-x,1));
elseif x<=1200
kn(x,:)=1/4*(pf(1603-x,1)+pf(1602-x,1)+pf(2003-x,1)+pf(2004-x,1));
elseif x<=1600
kn(x,:)=1/4*(pf(2004-x,1)+pf(2003-x,1)+pf(2404-x,1)+pf(2405-x,1));
elseif x<=2000
kn(x,:)=1/4*(pf(2405-x,1)+pf(2404-x,1)+pf(2805-x,1)+pf(2806-x,1));
....,....
else x<=160000
i think its takes time since doing the same wrote until 160000
anyone could help me to make it simple?

1 comentario

Arif Hoq
Arif Hoq el 13 de Mzo. de 2022
please attach your data. i think you can use reshape function rather than for loop

Iniciar sesión para comentar.

Respuestas (1)

Agung Putra
Agung Putra el 13 de Mzo. de 2022

0 votos

please kindly find the data as point x,y and z axis

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Preguntada:

el 13 de Mzo. de 2022

Respondida:

el 13 de Mzo. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by