Asked by swati mane
on 19 Jul 2019

Hello,

I am working with for loop in my code. I am getting the answer but after 8 steps i.e. from the step 9, the value of array is overwritten.

means The value I was getting at column 2 in the first 8 steps , I am getting that value in the column 5 when i start with step 9.

please help me for the same.

Answer by Jan
on 19 Jul 2019

Accepted Answer

Prefer file names including leading zeros: image0001.jpg, image 0002.jpg etc. Then the numeical order equals the alphabetical order.

If you have the less useful naming scheme already, use https://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort to get it in order.

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 16 Comments

## KALYAN ACHARJYA (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_725996

## Nicolas Broch (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_725997

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726000

## madhan ravi (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726004

## Jan (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726029

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726075

## Guillaume (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726084

## Joel Handy (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726105

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726107

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726109

## Joel Handy (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726111

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726114

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726116

## Joel Handy (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726124

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_726130

## swati mane (view profile)

## Direct link to this comment

https://nl.mathworks.com/matlabcentral/answers/472448-array-values-are-overwritten#comment_727885

Sign in to comment.