Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matlab to Python
#4
You need more that just change the input to a pandas DataFrame to convert a matlab script to a python one.
First of all, array indexing in matlab uses the (i, j...) syntax with indexes starting at 1 and python uses [i, j...] with first element 0.
The ismember operation in python is done using sets or list with the syntax "if x in {1, 2, 3}" but in matlab can have several uses and you must see really which is the intended selection.

My recommendation is that you read first the introduction to python and numpy or otherwise your task will be almost impossible...

Otherwise you might want to explore the Matlab to Python conversion using some of the tools of this StackOverflow question or this post or stick to matlab and use octave or scilab.

... and I think I abuse of the links a little bit.
Reply


Messages In This Thread
Matlab to Python - by Ariane - Jun-11-2018, 02:22 PM
RE: Matlab to Python - by j.crater - Jun-11-2018, 04:27 PM
RE: Matlab to Python - by DeaD_EyE - Jun-11-2018, 04:44 PM
RE: Matlab to Python - by killerrex - Jun-11-2018, 08:46 PM
RE: Matlab to Python - by Ariane - Jun-12-2018, 09:35 AM
RE: Matlab to Python - by Ariane - Jun-13-2018, 01:02 PM
RE: Matlab to Python - by Ariane - Jun-14-2018, 12:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem of converting Matlab code to python DongyanZ 2 1,479 Feb-03-2023, 01:04 PM
Last Post: jefsummers
  Convolution "same" in Python doesn't work as Matlab claw91 4 3,897 Oct-01-2020, 08:59 AM
Last Post: claw91
  Python equivalent of Matlab code kwokmaster 5 7,243 Apr-03-2020, 12:02 AM
Last Post: scidam
  Is there similar function to lsqnonlin (in matlab) in python? Jay_Nerella 1 6,090 Nov-11-2019, 08:40 AM
Last Post: feli_x
  How to use .m matlab file in python ? sameer 5 15,577 May-10-2018, 09:39 AM
Last Post: wavic
  Importing matlab cell array (.mat) into a python list scanato 0 8,731 Nov-15-2017, 11:04 AM
Last Post: scanato

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020