Multiply matrix column by an equation

2 visualizaciones (últimos 30 días)
Sabrina Fleming
Sabrina Fleming el 10 de Nov. de 2021
Respondida: Fangjun Jiang el 10 de Nov. de 2021
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.

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by