Can I have both perl.m and python.m so that I can call either perl or python from matlab? Without knowing exactly how the original perl.m works, I do not feel comfortable simply to replace "perl" with "python". Please help.
Asked
Active
Viewed 998 times
0
-
3upvote? ... ah, woe to the Electorate badge ;-( – Eli Bendersky Apr 28 '11 at 05:19
-
1possible duplicate of [Call python function from MATLAB](http://stackoverflow.com/questions/1707780/call-python-function-from-matlab) – Amro Aug 03 '12 at 20:30
-
Possible duplicate of [Call Python function from MATLAB](https://stackoverflow.com/questions/1707780/call-python-function-from-matlab) – 0 _ Sep 25 '17 at 00:22
2 Answers
3
If I understand you correctly, you have a file perl.m
used to invoke Perl scripts from Matlab? Of course you can't just change its name to python.m
and expect it to run Python!
You have to look inside perl.m
to see exactly what it does.
Alternatively, Google on calling Python from Matlab - this SO discussion and many other useful resources immediately come up.

Community
- 1
- 1

Eli Bendersky
- 263,248
- 89
- 350
- 412
0
You can use method:
status = dos(command)
where in 'command' You enter command like in terminal:
for example:
file - hw.py
print("Hello world")
matlab console:
dos('python yourDir\hw.py')
output in terminal:
Hello world

pezetem
- 2,503
- 2
- 20
- 38