How do I get a table calculation result in a single column?

Hi,
I'm trying to do an excel calculation in matlab but unsure how, I have these a b c variables in this sheet
and I'm just trying to do the CED calculation in matlab instead of in excel, the equation is simply:
(10^(a-(b/(c+T)))*133.322)^0.5
right now i'm reading my files as
T = readtable('C:\Users\Andrew Martin\Documents\PIP2.xlsx','NumHeaderLines',1);
T.Properties.VariableNames(1:10)={'Element','Num','E0','r','CED','Pvap','Tm','a','b','c'};
head(T)
ix=(T.Num>=12)&(T.Num<=35);
Tmp = 500;
cCED = ((10^(T.a(ix)-(T.b(ix)/(Tmp+T.c(ix)))))*133.322)^0.5;
but the result is giving me a 16x16 complex double instead of creating a single column of the calculated data based on the ix I selected.
My goal is trying so that I can input any different T (my variable) to get different CED values for each element.
Please help, thanks! Sorry I'm a coding noob.

 Respuesta aceptada

cCED = ((10.^(T.a(ix)-(T.b(ix)./(Tmp+T.c(ix)))))*133.322).^0.5;
Your T.c(idx) is a vector, you had a / operation with a vector denominator. That is not element-by-element division, that is least-squared-fitting, mrdivide, /
Also, ^ is mpower, ^ matrix power

Más respuestas (0)

Categorías

Productos

Versión

R2023a

Preguntada:

el 28 de Abr. de 2023

Respondida:

el 28 de Abr. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by