Multiply matrix column by an equation

조회 수: 2 (최근 30일)
Sabrina Fleming
Sabrina Fleming 2021년 11월 10일
답변: Fangjun Jiang 2021년 11월 10일
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.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2021년 11월 10일
A=[1:3;10:10:30]'
A(:,1)=log(A(:,1)+1)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by