Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the equivalent command 'end' of Matlab in python? [duplicate]

When I work in Matlab, I use the refer to the last element of a vector with 'end'. For example:

A(1, end)

where A is a 2x2 matrix.

Can you tell me what is the equaivalent command in python? For example, I have the following variable, as an element of a list of strings:

dataList[loc] = ['%Case study: test\n']

so the last element should be '\n'

like image 400
Domenico di Cugno Avatar asked Jun 23 '15 13:06

Domenico di Cugno


People also ask

What is the equivalent of of MATLAB in Python?

NumPy (Numerical Python) It provides a highly efficient interface to create and interact with multi-dimensional arrays. Nearly every other package in the SciPy stack uses or integrates with NumPy in some way. NumPy arrays are the equivalent to the basic array data structure in MATLAB.

Can I code MATLAB in Python?

MATLAB® provides a flexible, two-way integration with many programming languages, including Python. This allows different teams to work together and use MATLAB algorithms within production software and IT systems.

What is NumPy MATLAB?

NumPy contains both an array class and a matrix class. The array class is intended to be a general-purpose n-dimensional array for many kinds of numerical computing, while matrix is intended to facilitate linear algebra computations specifically. In practice there are only a handful of key differences between the two.

How do I export MATLAB to Python?

To convert Matlab to python, we have two options, either do it manually or take the help of some tool. To convert Matlab to python, a tool named SMOP (Small Matlab and Octave to Python Compiler) is used. This tool is capable of understanding basic Matlab code and then parsing it to python.


1 Answers

That would be using index [-1].

A[0][-1]

Negative indices start at [-1] and increment from the back of the sequence.

like image 154
Cory Kramer Avatar answered Nov 15 '22 00:11

Cory Kramer