Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started