Hi,
I understand that you want to execute a Python script from MATLAB and pass a filename stored in the MATLAB workspace as an input parameter to the Python script.
You can achieve this by using ‘pyrunfile’ function. The first argument of ‘pyrunfile’ function should be a string containing python script name followed by input arguments. Refer the below code snippet,
% file name stored in MATLAB variable
file_name = "<path>";
% python file name
python_file_name = "python_prog.py";
% create a string with python script name followed by input arguments
str = python_file_name + " " + file_name;
% displaying the string
disp(str);
% calling python file by passing matlab variable as argument
pyrunfile(str);
The python script will receive these inputs as strings. For example let’s consider above example, the script ‘python_prog’ will receive ‘<path>’ as a string.
For more information on how to use ‘pyrunfile’ function, refer the following documentation.
Hope this is helpful.