gpt4 book ai didi

matlab - 表中矩阵列的副标题

转载 作者:行者123 更新时间:2023-12-02 00:30:56 24 4
gpt4 key购买 nike

这是我的玩具示例:

t = table([1,2,3;4,5,6;7,8,9],[10,11,12;13,14,15;16,17,18]);
t.Properties.VariableNames = {'system1', 'system2'};
t.Properties.RowNames = {'obs1', 'obs2', 'obs3'};

我想知道是否可以为每个变量的三列分配子标题,例如{'min', 'mean', 'max'}

最佳答案

您可以使用如下所示的元胞数组将这些字幕放入变量中:

t = table({'min', 'mean', 'max';  1,  2,  3;  4,  5,  6;  7,  8,  9},...
{'min', 'mean', 'max'; 10, 11, 12; 13, 14, 15; 16, 17, 18});
t.Properties.VariableNames = {'system1', 'system2'};
t.Properties.RowNames = {'.','obs1', 'obs2', 'obs3'};
%if you don't like dot (.) as a row name, replace it with char(8203) to have nameless row

这将给出:

t =    
4×2 table
system1 system2
________________________ ________________________

. 'min' 'mean' 'max' 'min' 'mean' 'max'
obs1 [ 1] [ 2] [ 3] [ 10] [ 11] [ 12]
obs2 [ 4] [ 5] [ 6] [ 13] [ 14] [ 15]
obs3 [ 7] [ 8] [ 9] [ 16] [ 17] [ 18]

关于matlab - 表中矩阵列的副标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47797406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com