Matching two columns from an imported table to find the corresponding value in the 5th column.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Enrico Gambini
2022년 2월 2일
편집: Enrico Gambini
2022년 2월 2일
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
Enrico Gambini
2022년 2월 2일
If the pressure-temperature relation is univocal you can insert only the temperature. I edited
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Export to MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!