How can I save every 5 images in a loop?

2 views (last 30 days)
spider_plantt on 23 Jul 2020
Commented: spider_plantt on 23 Jul 2020
I have a binary file that's 256x256x256 pixels, displaying a 3D image of a sphere on an XYZ axis. I am trying to write a loop that will save "sliced" images of this object every 4 pixels, resulting in a slowly-increasing circle in the y-axis. The sphere "floats" on the XYZ axis, visible from y=29 to y=141. So I am trying to slice and save images at y=29, y=34, y=39, etc, until I reach y=141. As of now, it will just start at y=29 and save images at every single pixel value from 29 up till 141, so I'm ending up with 112 different images saved to my PC instead of the desired 28.
My code is below:
load ('sphere.mat');
for k=29:N
spider_plantt on 23 Jul 2020
Works like an absolute charm! Cannot thank you enough!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by