Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.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如何用宏优化代码_Matlab - Fatal编程技术网

MATLAB如何用宏优化代码

MATLAB如何用宏优化代码,matlab,Matlab,有没有一种方法可以通过使用宏作为示例来优化此代码?我在文档中没有找到任何东西 谢谢,您可以编写一个函数: if ispc bc = fullfile(tmp,'toto'); else bc = fullfile(tmp,'tata'); end 然后在调用原始代码的地方调用函数。AFAIK Matlab没有宏。这个代码有什么问题需要优化吗?我只想通过使用宏来避免C重复指令……Hi @ LoLA,你的许多问题仍然没有被接受的答案打开,但是看起来它们已经被解决了。当答案已经解决了你的问题时,请

有没有一种方法可以通过使用宏作为示例来优化此代码?我在文档中没有找到任何东西


谢谢,

您可以编写一个函数:

if ispc
bc = fullfile(tmp,'toto');
else 
bc = fullfile(tmp,'tata');
end

然后在调用原始代码的地方调用函数。

AFAIK Matlab没有宏。这个代码有什么问题需要优化吗?我只想通过使用宏来避免C重复指令……Hi @ LoLA,你的许多问题仍然没有被接受的答案打开,但是看起来它们已经被解决了。当答案已经解决了你的问题时,请点击检查标记来考虑。这向更广泛的社区表明,您已经找到了解决方案。
function bc = getBCFromTmpByPlatform(tmp)
    if ispc
        bc = fullfile(tmp,'toto');
    else 
        bc = fullfile(tmp,'tata');
    end
end