What while loop can be used here to stop Matlab giving me any reminder?

조회 수: 1 (최근 30일)
Hdez
Hdez 2020년 11월 16일
답변: David Hill 2020년 11월 16일
I don't want Matlab to give me any reminder resulsts in the hx or hy, just integer numbers.
h= input('Enter the desire grid spacing:');
hx=(lx/h)+ 1; %NC
hy=(ly/h)+ 1; %NR

답변 (1개)

David Hill
David Hill 2020년 11월 16일
Use floor and ceil
hx=floor(lx/h)+1;
hy=ceil(ly/h)+1;

카테고리

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