How can I create a table using ModelAdvisor.Table?

1 次查看(过去 30 天)
I found the help section for creating a table using ModelAdvisor.Table and followed the given example format exactly:
At the beginning of the example for the 5x5 table, it says to embed the code in a callback function. I have no idea what this means or how to do this. Since I don't know how to do this, the code runs but does not display the table I've created. I have included my code for reference, and would greatly appreciate any help. Thanks.
The actual data is saved in my workspace and is unavailable here.
meanice1Kin = mean(ice1Kinsulated);
meanice1K1 = mean(ice1Keden);
meanice1K2 = mean(ice1Ksean);
meanice1T1 = mean(ice1Tkristi);
meanice1T2 = mean(ice1Tmichael);
IceTrial1 = [meanice1Kin, meanice1K1, meanice1K2, meanice1T1, meanice1T2];
meanice2Kin = mean(ice2Kinsulated);
meanice2K1 = mean(ice2Keden);
meanice2K2 = mean(ice2Ksean);
meanice2T1 = mean(ice2Tkristi);
meanice2T2 = mean(ice2Tmichael);
IceTrial2 = [meanice2Kin, meanice2K1, meanice2K2, meanice2T1, meanice2T2];
meanice3Kin = mean(ice3Kinsulated);
meanice3K1 = mean(ice3Keden);
meanice3K2 = mean(ice3Ksean);
meanice3T1 = mean(ice3Tkristi);
meanice3T2 = mean(ice3Tmichael);
IceTrial3 = [meanice3Kin, meanice3K1, meanice3K2, meanice3T1, meanice3T2];
meanboil1Kin = mean(boil1Kinsulated);
meanboil1K1 = mean(boil1Keden);
meanboil1K2 = mean(boil1Ksean);
meanboil1T1 = mean(boil1Tkristi);
meanboil1T2 = mean(boil1Tmichael);
BoilTrial1 = [meanboil1Kin, meanboil1K1, meanboil1K2, meanboil1T1, meanboil1T2];
meanboil2Kin = mean(boil2Kinsulated);
meanboil2K1 = mean(boil2Keden);
meanboil2K2 = mean(boil2Ksean);
meanboil2T1 = mean(boil2Tkristi);
meanboil2T2 = mean(boil2Tmichael);
meanboil3Kin = mean(boil3Kinsulated);
BoilTrial2 = [meanboil2Kin, meanboil2K1, meanboil2K2, meanboil2T1, meanboil2T2];
meanboil3K1 = mean(boil3Keden);
meanboil3K2 = mean(boil3Ksean);
meanboil3T1 = mean(boil3Tkristi);
meanboil3T2 = mean(boil3Tmichael);
BoilTrial3 = [meanboil3Kin, meanboil3K1, meanboil3K2, meanboil3T1, meanboil3T2];
MeanMatrix = [IceTrial1; IceTrial2; IceTrial3; BoilTrial1; BoilTrial2; BoilTrial3];
% Initialize a Table with 6 Rows and 5 Columns
Means = ModelAdvisor.Table(6,5);
% Setting Column Headings
Means.setColHeading(1, 'Thermistor');
Means.setColHeading(2, 'K-Type 1');
Means.setColHeading(3, 'K-Type 2');
Means.setColHeading(4, 'T-Type 1');
Means.setColHeading(5, 'T-Type 2');
Means.setRowHeading(1, 'Ice Trial 1');
Means.setRowHeading(2, 'Ice Trial 2');
Means.setRowHeading(3, 'Ice Trial 3');
Means.setRowHeading(4, 'Boil Trial 1');
Means.setRowHeading(5, 'Boil Trial 2');
Means.setRowHeading(6, 'Boil Trial 3');
%Setting Alignment
for n=1:5
Means.setColHeadingAlign(n, 'center');
Means.setRowHeadingAlign(n, 'center');
end
% set Table content
for rowIndex=1:6
for colIndex=1:5
Means.setEntry(rowIndex, colIndex, num2str(MeanMatrix(rowIndex, colIndex)));
% set alignment of entries
Means.setEntryAlign(rowIndex, colIndex, 'center');
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by