how to get the name of current running m script

6 vues (au cours des 30 derniers jours)
wenchao zhang
wenchao zhang le 23 Mai 2024
Réponse apportée : Mirza le 31 Mai 2024
hello, how can i get the name of the script that is running at the moment, thanks.

Réponse acceptée

Aquatris
Aquatris le 23 Mai 2024
mfilename() function seems to be what you are looking for.
  1 commentaire
wenchao zhang
wenchao zhang le 23 Mai 2024
Modifié(e) : wenchao zhang le 23 Mai 2024
hi Aquatris, thanks for your quick respond, yes that's what i want.

Connectez-vous pour commenter.

Plus de réponses (1)

Mirza
Mirza le 31 Mai 2024

#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

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by