Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 是否在inputdlg框中显示循环计数的值?_Matlab - Fatal编程技术网

Matlab 是否在inputdlg框中显示循环计数的值?

Matlab 是否在inputdlg框中显示循环计数的值?,matlab,Matlab,为这个模糊的问题道歉,我写了一个简单的for statt,其中玩家是一个预先确定的整数: for k = 0:players; inputdlg('Enter the name of player (?): '); end 我希望在语句通过播放器编号计数时自动填充节(?)。 有人能建议一种方法吗? 谢谢 使用sprintf: for k = 0:players st = sprintf('Enter the name of player %d',k); inputdlg

为这个模糊的问题道歉,我写了一个简单的for statt,其中玩家是一个预先确定的整数:

for k = 0:players;
    inputdlg('Enter the name of player (?): ');
end
我希望在语句通过播放器编号计数时自动填充节(?)。 有人能建议一种方法吗?
谢谢

使用
sprintf

for k = 0:players
    st = sprintf('Enter the name of player %d',k);
    inputdlg(st);
end

使用
sprintf

for k = 0:players
    st = sprintf('Enter the name of player %d',k);
    inputdlg(st);
end

比如说,我想把这些名字转换成数字,我可以使用这样的东西吗:player_num%d=str2num(st%d)?比如说,我想把这些名字转换成数字,我可以使用这样的东西吗:player_num%d=str2num(st%d)?