IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MATLAB Discussion :

matlab compiler runtime [Compiler]


Sujet :

MATLAB

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    116
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 116
    Par défaut matlab compiler runtime
    Pour faire tourner Matlab Compiler Runtime sur un pc ou l´on n´a pas matlab et ou l´on veut deployer un executable cree a partir de librairie matalb ,de quoi as t´on besoin sur le pc.
    Parce que j´ai windows xp, j´ai installe .Net Framework 2.0 , MCRinstaller.exe, et Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) et ca ne marche toujours pas.
    Je ne sais plus trop quoi essayer.

  2. #2
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Par défaut
    Bonjour,

    Normalement pour faire tourner une application MatLab compilée sur un PC, il suffit d'installer le MCR correspondant à la version avec laquelle l'application a été compilée...

    Quelle erreur obtiens-tu lorsque tu lances ton application?

    Bonne soirée,
    Duf

  3. #3
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    Salut!

    Tu as ici les versions du matlab et les versions corespondant du MCR:

    Matlab version MCR version

    R2009a -> 7.10
    R2008b -> 7.9
    R2008a -> 7.8
    R2007b -> 7.7
    R2007a -> 7.6
    R2006b -> 7.5

    Pour Matlab Compiler 4.3 MCR v.7.3


    Tappes en command window:

    Pour voir ta version du matlab. Et je te dis la version MCR que tu as besoin sur l'ordinateur ou ne se trouve pas instale Matlab.

    Et fait un post avec ta version du Matlab!

    Bonne chance,

    Michel

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    116
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 116
    Par défaut
    En faite comme dans les exemples donnees par matlab j ai dans mon programme:
    if( !mclInitializeApplication(NULL,0) )
    {
    fprintf(out,"Could not initialize the application.\n");
    return -1;

    }
    et je vois ecris dons mon fichier out : Could not initialize the application.

    Mais je pense que j'ai la bonne version de MCR vu que je l'ai prise sur le matlab compiler que j'ai utilise pour creer ma c shared library comme indique dans l'aide matlab.(MATLABROOT\toolbox\compiler\deploy\win32\mcrInstaller.exe)
    j'utilise R2008a -> 7.8
    Ce qui est etrange cest que je peux utiliser ma librairie sur le pc avec matlab mais pas sur le pc sans matlab alors que je pense que c est la bonne version de MCR.

  5. #5
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    Oui c'est la bonne version de MCR 7.8.


    As-tu essaye d'installer cette version sur le pc qui n'a pas matlab et voir puis si l'application fonctionne?

    http://www.sferic.com/Matlab/CompilerRunTime.htm


    Mais c'est une autre version du MCR. Cherche a installer MCR v.7.8 sur l'autre PC qui ne possede Matlab installe et voir puis si l'application fonctionne.

    Bonne chance,

    Michel

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    116
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 116
    Par défaut
    je viens d´essayer d´utiliser un exemple donne par matlab pour creer une standalone application matrixdriver.exe:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    MATRIXDRIVER.C	Sample driver code that calls the shared
     *	        library created using MATLAB Compiler. Refer to the 
     *          documentation of MATLAB Compiler for more information on
     *          this
     *
     * This is the wrapper C code to call a shared library created 
     * using MATLAB Compiler.
     *
     * Copyright 1984-2005 The MathWorks, Inc.
     *
     *=================================================================*/
     
    #include <stdio.h>
     
    /* Include the MCR header file and the library specific header file 
     * as generated by MATLAB Compiler */
    #include "libmatrix.h"
     
    /* This function is used to display a double matrix stored in an mxArray */
    void display(const mxArray* in);
     
    int run_main(int argc, char **argv)
    {
        mxArray *in1, *in2; /* Define input parameters */
        mxArray *out = NULL;/* and output parameters to be passed to the library functions */
        float x;
        double data[] = {1,2,3,4,5,6,7,8,9};
     
        /* Call the mclInitializeApplication routine. Make sure that the application
         * was initialized properly by checking the return status. This initialization
         * has to be done before calling any MATLAB API's or MATLAB Compiler generated
         * shared library functions.  */
        if( !mclInitializeApplication(NULL,0) )
        {
            fprintf(stderr, "Could not initialize the application.\n");
        	return -1;
        }
     
        /* Create the input data */
        in1 = mxCreateDoubleMatrix(3,3,mxREAL);
        in2 = mxCreateDoubleMatrix(3,3,mxREAL);
        memcpy(mxGetPr(in1), data, 9*sizeof(double));
        memcpy(mxGetPr(in2), data, 9*sizeof(double));
     
        /* Call the library intialization routine and make sure that the
         * library was initialized properly. */
        if (!libmatrixInitialize()){
            fprintf(stderr,"Could not initialize the library.\n");
            return -2;
        }
        else
        {
            /* Call the library function */
            mlfAddmatrix(1, &out, in1, in2);
        /* Display the return value of the library function */
            printf("The value of added matrix is:\n");
            display(out);
        /* Destroy the return value since this varaible will be resued in
         * the next function call. Since we are going to reuse the variable,
         * we have to set it to NULL. Refer to MATLAB Compiler documentation
         * for more information on this. */
            mxDestroyArray(out); out=0;
            mlfMultiplymatrix(1, &out, in1, in2);
            printf("The value of the multiplied matrix is:\n");
            display(out);
            mxDestroyArray(out); out=0;
            mlfEigmatrix(1, &out, in1);
            printf("The eigenvalues of the first matrix are:\n");
            display(out);
            mxDestroyArray(out); out=0;
            printf("Donnez un nombre : ");
            scanf("%f", &x);
     
     
        /* Call the library termination routine */
            libmatrixTerminate();
     
        /* Free the memory created */
            mxDestroyArray(in1); in1=0;
            mxDestroyArray(in2); in2 = 0;
        }
     
    /* Note that you should call mclTerminate application at the end of
     * your application.
     */
        mclTerminateApplication();
        return 0;
    }
     
     
    /*DISPLAY This function will display the double matrix stored in an mxArray.
     * This function assumes that the mxArray passed as input contains double
     * array.
     */
    void display(const mxArray* in)
    {
        int i=0, j=0; /* loop index variables */
        int r=0, c=0; /* variables to store the row and column length of the matrix */
        double *data; /* variable to point to the double data stored within the mxArray */
     
        /* Get the size of the matrix */
        r = mxGetM(in);
        c = mxGetN(in);
        /* Get a pointer to the double data in mxArray */
        data = mxGetPr(in);
     
        /* Loop through the data and display the same in matrix format */
        for( i = 0; i < c; i++ ){
            for( j = 0; j < r; j++){
                printf("%4.2f\t",data[j*c+i]);
            }
            printf("\n");
        }
        printf("\n");
    }
     
    int main()
    {
        mclmcrInitialize();
        return mclRunMain((mclMainFcnType)run_main,0,NULL);
    }
    et ca marche sur le pc sans matlab avec le mcr.
    Donc la je ne sais pas du tout pourquoi je peux utiliser la stand alone application parce que pour construire la stand alone application j´ai

    if( !mclInitializeApplication(NULL,0) )
    {
    fprintf(out,"Could not initialize the application.\n");
    return -1;

    }
    comme dans mon programme qui apelle la c shared library.Mais pourquoi ca marche avec la stand alone application et non avec la c shared library puisque que j´utilise les memes choses pour initialiser l´application et la librairie.

  7. #7
    Membre éprouvé
    Avatar de mihaispr
    Inscrit en
    Décembre 2008
    Messages
    1 025
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 025
    Par défaut
    Comment tu as fais ca?

    Je dois mettre aussi un executable fais par moi en matlab sur une autre pc qui n'a pas du matlab.


    Peux tu m'expliquer en details les etapes que tu as parcouru?


    Parce que je dois faire la meme chose que toi.

    J'attends ton reponse!

    Merci!

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    116
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 116
    Par défaut
    Ba si tu veux je peux t´expliquer mais c´est tout dans l´help de matlab compiler.
    J´ai creer une c shared library avec trois fichiers .m:

    mcc -B csharedlib:libmatrix addmatrix.m multiplymatrix.m eigmatrix.m -v
    ensuite j´ai utilise matrixdriver.c qui utilise la librairie:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    /*=================================================================
     *
     * MATRIXDRIVER.C	Sample driver code that calls the shared
     *	        library created using MATLAB Compiler. Refer to the 
     *          documentation of MATLAB Compiler for more information on
     *          this
     *
     * This is the wrapper C code to call a shared library created 
     * using MATLAB Compiler.
     *
     * Copyright 1984-2005 The MathWorks, Inc.
     *
     *=================================================================*/
     
    #include <stdio.h>
     
    /* Include the MCR header file and the library specific header file 
     * as generated by MATLAB Compiler */
    #include "libmatrix.h"
     
    /* This function is used to display a double matrix stored in an mxArray */
    void display(const mxArray* in);
     
    int run_main(int argc, char **argv)
    {
        mxArray *in1, *in2; /* Define input parameters */
        mxArray *out = NULL;/* and output parameters to be passed to the library functions */
        float x;
        double data[] = {1,2,3,4,5,6,7,8,9};
     
        /* Call the mclInitializeApplication routine. Make sure that the application
         * was initialized properly by checking the return status. This initialization
         * has to be done before calling any MATLAB API's or MATLAB Compiler generated
         * shared library functions.  */
        if( !mclInitializeApplication(NULL,0) )
        {
            fprintf(stderr, "Could not initialize the application.\n");
        	return -1;
        }
     
        /* Create the input data */
        in1 = mxCreateDoubleMatrix(3,3,mxREAL);
        in2 = mxCreateDoubleMatrix(3,3,mxREAL);
        memcpy(mxGetPr(in1), data, 9*sizeof(double));
        memcpy(mxGetPr(in2), data, 9*sizeof(double));
     
        /* Call the library intialization routine and make sure that the
         * library was initialized properly. */
        if (!libmatrixInitialize()){
            fprintf(stderr,"Could not initialize the library.\n");
            return -2;
        }
        else
        {
            /* Call the library function */
            mlfAddmatrix(1, &out, in1, in2);
        /* Display the return value of the library function */
            printf("The value of added matrix is:\n");
            display(out);
        /* Destroy the return value since this varaible will be resued in
         * the next function call. Since we are going to reuse the variable,
         * we have to set it to NULL. Refer to MATLAB Compiler documentation
         * for more information on this. */
            mxDestroyArray(out); out=0;
            mlfMultiplymatrix(1, &out, in1, in2);
            printf("The value of the multiplied matrix is:\n");
            display(out);
            mxDestroyArray(out); out=0;
            mlfEigmatrix(1, &out, in1);
            printf("The eigenvalues of the first matrix are:\n");
            display(out);
            mxDestroyArray(out); out=0;
            printf("Donnez un nombre : ");
            scanf("%f", &x);
     
     
        /* Call the library termination routine */
            libmatrixTerminate();
     
        /* Free the memory created */
            mxDestroyArray(in1); in1=0;
            mxDestroyArray(in2); in2 = 0;
        }
     
    /* Note that you should call mclTerminate application at the end of
     * your application.
     */
        mclTerminateApplication();
        return 0;
    }
     
     
    /*DISPLAY This function will display the double matrix stored in an mxArray.
     * This function assumes that the mxArray passed as input contains double
     * array.
     */
    void display(const mxArray* in)
    {
        int i=0, j=0; /* loop index variables */
        int r=0, c=0; /* variables to store the row and column length of the matrix */
        double *data; /* variable to point to the double data stored within the mxArray */
     
        /* Get the size of the matrix */
        r = mxGetM(in);
        c = mxGetN(in);
        /* Get a pointer to the double data in mxArray */
        data = mxGetPr(in);
     
        /* Loop through the data and display the same in matrix format */
        for( i = 0; i < c; i++ ){
            for( j = 0; j < r; j++){
                printf("%4.2f\t",data[j*c+i]);
            }
            printf("\n");
        }
        printf("\n");
    }
     
    int main()
    {
        mclmcrInitialize();
        return mclRunMain((mclMainFcnType)run_main,0,NULL);
    }
    et ensuite : mbuild matrixdriver.c libmatrix.lib
    Voila, moi je crois que je vai essaye dinstaller matlab sur le pc piur voir si mon probleme vient de la ou pas,m ais je pense pas vu que ca marche pour une standalone application.
    Pour revenir a mon probleme, j´utilise la librairie creer par matlab de la meme facon que dans matrix driver mais je ne sais pas si c´est ce que je dois faire ou nan.Je met le .h de la librairie dans mon programme en c, le .lib dans le projet et le .dll cree avec implib au meme endroit ou se cree l´exe de mon application. il n y pas de probleme de compilation mais j´ai l´erreur comme quoi ca ne peut pas initialiser lapplication.

  9. #9
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    116
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 116
    Par défaut
    J´ai resolu mon probleme. En faite il fallait seulement cocher la case mbuild with runtime package dans les options de mon projet creer avec c++builder .

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Matlab compilé - Garder fenêtre DOS ouverte
    Par Newenda dans le forum MATLAB
    Réponses: 2
    Dernier message: 03/04/2009, 09h13
  2. Question Matlab compiler
    Par Antale dans le forum MATLAB
    Réponses: 1
    Dernier message: 30/09/2008, 17h38
  3. matlab compilation au C++
    Par rabie80 dans le forum MATLAB
    Réponses: 1
    Dernier message: 06/12/2007, 17h48
  4. Code MATLAB compilé en C/C++
    Par boundrey dans le forum MATLAB
    Réponses: 14
    Dernier message: 04/11/2007, 00h11
  5. [Compiler] Comment savoir si le MATLAB Compiler est installé ?
    Par berberat dans le forum MATLAB
    Réponses: 2
    Dernier message: 26/09/2007, 11h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo