matlab text 字符串,如何將變量值放入到MATLAB中的文本字符串中?

这篇博客探讨了如何在MATLAB中将变量值整合到文本字符串中。作者遇到问题,尝试将函数的输出(x, y, d, e, f)与字符串结合,但未能成功。解决方案包括使用FPRINTF、SPRINTF、NUM2STR或INT2STR等函数将数值转换为字符串,并使用单元数组来存储不同长度的字符串。此外,还讨论了函数返回默认值""ans 3""的原因以及如何正确获取所有输出值。" 134613219,11254346,全国天气可视化分析系统基于Hadoop实现,"['数据分析', 'hadoop', '数据库管理']
摘要由CSDN通过智能技术生成

I'm trying to write a simple function that takes two inputs, x and y, and passes these to three other simple functions that add, multiply, and divide them. The main function should then display the results as a string containing x, y, and the totals.

我試着寫一個簡單的函數,它接受兩個輸入,x和y,然后把它們傳遞給另外三個簡單的函數,它們相加,相乘,然后除以它們。主函數應該將結果顯示為包含x、y和總數的字符串。

I think there's something I'm not understanding about output arguments. Anyway, here's my (pitiful) code:

我認為有些東西我不理解輸出參數。不管怎樣,這是我的(可憐的)代碼:

function a=addxy(x,y)

a=x+y;

function b=mxy(x,y)

b=x*y;

function c=dxy(x,y)

c=x/y;

The main function is:

主要功能是:

function [d e f]=answer(x,y)

d=addxy(x,y);

e=mxy(x,y);

f=dxy(x,y);

z=[d e f]

How do I get the values for x, y, d,

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值