How to create a function which takes one column of data as its input and another as its output

6 views (last 30 days)
I have two columns of data and need to come up with a function that take as input the values from the first column of data and outputs the corresponding values in the second column. There is no equation that links the columns together they are just two lines of data. How would I go about coming up with a function that enables me to input a value from the first column and be given the corresponding value in the second?
Gabriel on 27 Feb 2023
No so for example column 1 row 6 will correspond to column 2 row 6 and column 1 row 10 corresponds to column 2 row 10. I need a function that allows me to input the values in column 1 and get the value next to it in column 2 as my output. I hope that makes sense

Sign in to comment.

Accepted Answer

David Hill
David Hill on 27 Feb 2023
Just use the find function. find
A = 10×2
42 42 73 69 1 21 31 88 15 3 10 68 19 42 35 56 40 15 54 20
f = 31

Sign in to comment.

More Answers (0)


Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by