gpt4 book ai didi

matlab - 如何在 Matlab 中打印字符串?

转载 作者:行者123 更新时间:2023-12-05 03:14:57 25 4
gpt4 key购买 nike

我这样做是为了输出字符串的内容(仅此而已):

fprintf( '%s', my_str );

但感觉我错过了一个只接受 my_str 作为参数的函数。我应该使用哪个函数?

最佳答案

disp 是您要查找的内容,如:

>>disp string  %command format for single string arguments
string
>>disp 'string test'
string test
>>disp ('string test') %function format
string test

和一个变量

>> test= 'string';
>> disp(test)
string

但不是

>>disp string test
Error using disp
Too many input arguments.

而且您始终可以这样做:

>> a = 'string';
>> a

a =

string

关于matlab - 如何在 Matlab 中打印字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22010495/

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