Anonymous function outputs to table

조회 수: 2 (최근 30일)
ingeik
ingeik 2019년 11월 11일
댓글: ingeik 2019년 11월 11일
doublingtime = @(q) log(2)/log(1+q);
dt = doublingtime(q);
This is the relevant code. I want to make a 25x2 table which shows q values and the corresponding dt values. I want q to go from 0 to 0.25 with a step of 0.01 each time. I've tried all sorts of method to make it work, but im stuck.

채택된 답변

KSSV
KSSV 2019년 11월 11일
q = 0:0.01:0.25 ;
doublingtime = @(q) log(2)./log(1+q);
dt = doublingtime(q);
T = table(q,dt)
  댓글 수: 1
ingeik
ingeik 2019년 11월 11일
q = 0:0.01:0.25 ;
doublingtime = @(q) log(2)./log(1+q);
dt = doublingtime(q);
T = table(q',dt', 'VariableNames', {'q', 'dt'});
disp(T)
Thank you. After just tweaking your answer a little bit, I got it to work the way I wanted!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by