What existing function can be used to divide two columns of a matrix by each other?

조회 수: 8 (최근 30일)
I am working with a Matlab code that uses an XML-file. The XML structure is built up of multiple lines in style of: Name of the output: "...", Name of the input: "...", function: "..." I can not use self constructed functions, only ones that are already available in the Matlab Toolbox. Adding self-constructed function to the setup would be very time consuming, even though they would be simple. As an input, I can only put one Matrix. If I want to hand over 2 arrays of length x, they will be converted to a x*2 matrix and the function of choice will be applied to the matrix. Now I want to divide numbers in column 1 of the matrix by the numbers in column 2. Is there any way this can be done with preexisting functions?

답변 (2개)

Sean de Wolski
Sean de Wolski 2016년 10월 25일
x./y
?
In R2016b, this will implicitly expand to work on matrices with compatible sizes
  댓글 수: 1
Johanna Maynes
Johanna Maynes 2016년 10월 25일
Thank you for your answer. The issue is that I can not give two inputs. I essentially need a function:
function X=divide(X)
that only takes one Input, X, which is a Matrix.

댓글을 달려면 로그인하십시오.


Paul Smits
Paul Smits 2019년 5월 14일
out=in(:,1)./in(:,2)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by