0

In Matlab you can do things such as

Mat1[: , end] = max( Value1 * (Mat2[:, end]-Value2 ),0)

I tried the equivalent in Python but i'm getting an error and i'm not sure why

Mat1[: , -1] = max( Value1 * (Mat2[:, -1]-Value2 ),0)

The error is below

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

1 Answer 1

1

You are using the python builtin method max, use np.max instead:

import numpy as np
Mat1[: , -1] = np.max( Value1 * (Mat2[:, -1]-Value2 ),0)
Sign up to request clarification or add additional context in comments.

2 Comments

its the little things you forget at 4 am that make all the difference thanks
I'm sure I don't represent any majority

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.