I figured it out and am posting the answer in case anyone else has this problem:
I had an extra semicolon after original_boresight_verification. It was this:
subprocess.run(['matlab', '-batch', 'original_boresight_verification; C:\\Users\\17037\\Documents\\35844\\ROCK-537F25-2021-08-24-20-25-08\\clouds\\ppk_cloud_1.las'], capture_output=True, text=True, cwd=working_dir)
and now it is:
subprocess.run(['matlab', '-batch', 'original_boresight_verification C:\\Users\\17037\\Documents\\35844\\ROCK-537F25-2021-08-24-20-25-08\\clouds\\ppk_cloud_1.las'], capture_output=True, text=True, cwd=working_dir)
This was causing varargin to have multiple inputs whereas it should only have one. Not sure why this returned an "Invalid use of operator" error though.
If you are having a similar problem I would suggest the following steps to work through the problem (this is what I did):
- Check your function works in Matlab
- Check your function works in the command window (by itself not with python): use "cd 'path'" to navigate to the directory of your matlab file, then try
>matlab -batch "function_name argument_go_here"
Once this works go back and put it in python using the subprocess module (do not forget to import it), it should work now. :)