import numpy as np
# Example input variables with inconsistent sample numbers
variable1 = np.array([1, 2, 3, 4]) # 4 samples
variable2 = np.array([5, 6, 7]) # 3 samples
variable3 = np.array([8, 9]) # 2 samples
# Create a list of variables
variables = [variable1, variable2, variable3]
# Find the minimum number of samples among all variables
min_samples = min(len(var) for var in variables)
# Trim all variables to have the same number of samples
variables = [var[:min_samples] for var in variables]
# Now all input variables have the same number of samples
# You can continue working with the trimmed variables