Multiply matrix column by an equation

2 views (last 30 days)
I used A= readmatrix() to create a very large matrix from data in an excel file and now have:
[x1 z1
x2 z2
x3 z3 ] etc.
I'd like to take all the current "x" values in column 1 and apply the funtion y=ln(1+x) and create a new matrix with:
[y1 z1
y2 z2
y3 z3] etc.
I tried using a for loop, but didn't know how to input the existing x values into the function.
Any advice welcome, please let me know if you'd like more info.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 10 Nov 2021
A=[1:3;10:10:30]'
A(:,1)=log(A(:,1)+1)

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices 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!