Matlab:如何基于模板发布数据报表

Matlab: How to publish data report based on a template

我想生成一个自动填写的报告,像这样

非商业合约的净持仓量为 -21649 份合约,商业合约为 20348 份合约。

我用了sprintf

    sprintf ('The net open interest of the non-commercials is %d contracts, and commercials %d contracts,'..., 
    concise_COT_EUR.net_NonComm(1), concise_COT_EUR.net_Comm(1));

然而,在报告中,它显示

ans = The net open interest of the non-commercials is -21649 contracts, and commercials 20348 contracts,

我不想要 ans =。我有很多行。每次我尝试自动填写一些东西时,它都会给我 ans =。 如何摆脱它? 我想一定有其他方法可以做到这一点。谢谢!

第一个:

使用 fprintf 怎么样?

fprintf('The net open interest of the non-commercials is %d contracts, and commercials %d contracts,\n', concise_COT_EUR.net_NonComm(1), concise_COT_EUR.net_Comm(1))

第二个:

另一种方法是将 disp 环绕在 sprintf

周围
disp(sprintf('The net open interest of the non-commercials is %d contracts, and commercials %d contracts,', concise_COT_EUR.net_NonComm(1), concise_COT_EUR.net_Comm(1)))