How to display -180 to 180 in a loop

2 views (last 30 days)
MKANWAR HOSSAIN
MKANWAR HOSSAIN on 14 Oct 2021
Answered: Catalytic on 14 Oct 2021
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.

Answers (1)

Catalytic
Catalytic on 14 Oct 2021
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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!