how to get the name of current running m script

5 次查看(过去 30 天)
hello, how can i get the name of the script that is running at the moment, thanks.

采纳的回答

Aquatris
Aquatris 2024-5-23
mfilename() function seems to be what you are looking for.

更多回答(1 个)

Mirza
Mirza 2024-5-31

#include "engine.h" #include iostream

int main() { // Memulai MATLAB engine Engine *ep = engOpen(nullptr); if (!ep) { std::cerr << "Gagal memulai MATLAB engine" << std::endl; return 1; }

    int bilangan;
    std::cout << "Masukkan sebuah bilangan bulat: ";
    std::cin >> bilangan;
    // Menyimpan bilangan dalam variabel MATLAB
    mxArray *mxBilangan = mxCreateDoubleScalar(static_cast<double>(bilangan));
    engPutVariable(ep, "bilangan", mxBilangan);
    // Menampilkan bilangan di MATLAB
    engEvalString(ep, "disp(['Anda memasukkan bilangan: ', num2str(bilangan)])");
    // Membersihkan variabel dan menutup MATLAB engine
    mxDestroyArray(mxBilangan);
    engClose(ep);
    return 0;
}
if true
  % code
end

类别

Help CenterFile Exchange 中查找有关 Spline Postprocessing 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by