How to display -180 to 180 in a loop

조회 수: 2 (최근 30일)
MKANWAR HOSSAIN
MKANWAR HOSSAIN 2021년 10월 14일
답변: Catalytic 2021년 10월 14일
I am begineer level of MATLAB user. please forgieve me. which I want to do that is,
180 185 190 195 200 205 210 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 305 310 315 320 325 330 335 340 345 350 355 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180
180 is two times here(first and last), because the tested data starts from 180 to 360 and finishes to180 again. And it loops continue for a fixed times. I want to display data from -180 to 0 to +180, to describe more easily, the data should be (-180 -175 -170....170 175 180).
Please tell the calculation method. Thank you very much for your cooperation.

답변 (1개)

Catalytic
Catalytic 2021년 10월 14일
mod(180:5:360+180,360)
ans = 1×73
180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 305 310 315 320 325

카테고리

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