Question: I am translating from matlab to python: This is the code I have in matlab: [~,IHR] = sort([1,7]) it returns: IHR = 1 2 my

I am translating from matlab to python:

This is the code I have in matlab:

[~,IHR] = sort([1,7])

it returns: IHR = 1 2

my python code is as follows:

import numpy as np

IHR = np.sort([1,7])

# [temp,IHR] = np.sort([1,7]) # I also tried this, same result though.

which returns: [1 7]

My question is: Is there a replacement for ~ in python or do the sort functions work differently in matlab and python.

I need to get the same output from matlab so [1 2]. How would I do this?

Thank you so much my friend.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!