Matching two columns from an imported table to find the corresponding value in the 5th column.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Samuel Ofosu-Yeboah
am 2 Feb. 2022
Kommentiert: Samuel Ofosu-Yeboah
am 2 Feb. 2022
I have a 401 x 12 table that was imported from excel into matlab. I want a function that returns a value from the 5th column when I give two values from the first two columns.
2 Kommentare
Akzeptierte Antwort
Enrico Gambini
am 2 Feb. 2022
Bearbeitet: Enrico Gambini
am 2 Feb. 2022
One method to extract what you want could be
temp=input("Insert temperature: \n"); %here you insert the parameters in the command window
%Otherwise you can do manually from the code
temp=360; %you can change it
Then you can create your function code file
function enthalpy=find_enthalpy(temp)
idx=find((Table.Temperature(:)==temp); %i called "Table" your table from excel
enthalpy=Table.Enthalpy(idx);
fprintf("The enthalpy is :",enthalpy); %not necessary
end
From your script, or directly from command window you can call the function
enthalpy=find_enthalpy(temp)
Let me know if works
5 Kommentare
Enrico Gambini
am 2 Feb. 2022
If the pressure-temperature relation is univocal you can insert only the temperature. I edited
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Export to MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!