Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

Is SHRD compatible with individual career aspirations

Answered: 1 week ago

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

How was your life influenced by those events?

Answered: 1 week ago

Question

Which of these influenced your life most dramatically?

Answered: 1 week ago