The problem are inconsistent sizes of the matrices you are training to put together. First, you initialize
to be a 0x0 matrix. Then you try to combine it with the newly imported image, which has most likely a different number of rows
image_data1 = [image_data1, last_image];
Since horzcat is the function behind [a,b], the error message means that you cannot put a matrix with 0 rows in front of a matrix with a non-zero number of rows.
If all images have the same number of rows, you should load the first image before the loop to initialize image_data1. Alternatively, you could load the images into a 3D array. Since you seem to know the number of images ahead of time, you could preallocate the array before the loop to save time.