If you really want to go the 4D array route this is how I would approach it (might not be optimal).
Note that scipy.io.loadmat() returns a dictionary so you’ll need to know the name of the variable stored within it.
import glob
import os

DATASET_PATH = "D:/Dataset/Multi-resolution_data/Visual/High/"
VARIABLE_NAME = "example"
files = glob.glob(DATASET_PATH + “**/*.mat”, recursive= True)

class_labels = [i.split(os.sep)[-2] for i in files]
class_dict = {label: index for index, label in enumerate(set(class_labels))}
class_idxs = [class_dict[label] for label in class_labels]

array_store = []
 
for f in files:
    mat_dict = scipy.io.loadmat(f)
    img = mat_dict[VARIABLE_NAME]
    array_store.append(img)

stacked_array = np.stack(array_store, axis=3)

# convert to torch.tensor ...