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 :

Problème fprintf [Débutant]


Sujet :

MATLAB

  1. #21
    Membre actif
    Inscrit en
    Novembre 2006
    Messages
    236
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 236
    Points : 213
    Points
    213
    Par défaut
    Citation Envoyé par 8twilight8 Voir le message
    J'ai essayé

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    fid2 = fopen('toto.txt');
    C = textscan(fid2,'%s age=%f taille=%f ');
    C{:}
    fclose(fid2);
    ça dit que C{2} et C{3} sont vides
    j'ai recopié exactement ton morceau de code, et ça me renvoit bien :
    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
     
     
    ans = 
     
        'Julien'
        'Marc'
        'julie'
     
     
    ans =
     
        18
        25
        12
     
     
    ans =
     
        32
        39
        29
    Tu peux nous envoyer ton toto.txt pour voir ?
    MATLAB R2008a - Windows XP 32 bit et Windows Vista 64 bit

  2. #22
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Points : 34
    Points
    34
    Par défaut
    Je ne comprends pas comment ça peut fonctionner chez toi et pas chez moi
    Fichiers attachés Fichiers attachés

  3. #23
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Points : 34
    Points
    34
    Par défaut
    Ok maintenant ça fonctionne
    J'ai pris ce fichier toto pour essayer avant de tester sur mon fichier
    Je viens de tester sur mon vrai fichier et ça ne fonctionne pas alors qu'il est à peu près pareil.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    fid2 = fopen('tata.txt');
    C = textscan(fid2,'%s %s RBF=%f C=%f ');
    C{:}
    fclose(fid2);
    Fichiers attachés Fichiers attachés

  4. #24
    Membre actif
    Inscrit en
    Novembre 2006
    Messages
    236
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 236
    Points : 213
    Points
    213
    Par défaut
    Bizarrement, ça fonctionne bien...

    tu lances exactement ces lignes-là ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    fid2 = fopen('toto.txt');
    C = textscan(fid2,'%s age=%f taille=%f ');
    C{:}
    fclose(fid2);
    Peut-être une version différente de matlab, mais ça m'étonnerait que ce soit lié à ça
    MATLAB R2008a - Windows XP 32 bit et Windows Vista 64 bit

  5. #25
    Membre actif
    Inscrit en
    Novembre 2006
    Messages
    236
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 236
    Points : 213
    Points
    213
    Par défaut
    Citation Envoyé par 8twilight8 Voir le message
    Ok maintenant ça fonctionne
    J'ai pris ce fichier toto pour essayer avant de tester sur mon fichier
    Je viens de tester sur mon vrai fichier et ça ne fonctionne pas alors qu'il est à peu près pareil.
    qu'est ce que tu lances exactement comme commandes ?
    MATLAB R2008a - Windows XP 32 bit et Windows Vista 64 bit

  6. #26
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Points : 34
    Points
    34
    Par défaut
    Voici le résulats
    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
    ans = 
     
        '1:gridsel(svm'
     
     
    ans = 
     
        'kernel'
     
     
    ans =
     
       Empty matrix: 0-by-1
     
     
    ans =
     
       Empty matrix: 0-by-1

  7. #27
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Points : 34
    Points
    34
    Par défaut
    C'est bon j'ai compris mon erreur je n'ai pas utiliser la bonne case.
    ça marche.
    MERCI d'avoir jeté un coup d'oeil

  8. #28
    Membre actif
    Inscrit en
    Novembre 2006
    Messages
    236
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 236
    Points : 213
    Points
    213
    Par défaut
    j'ai réussi avec ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    fid = fopen('tata.txt');
    C = textscan(fid,'%f:gridsel(svm kernel rbf=%f C=%f) ');
    C{:}
    fclose(fid);
    quelle est la solution que tu as trouvée ?
    MATLAB R2008a - Windows XP 32 bit et Windows Vista 64 bit

  9. #29
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Points : 34
    Points
    34
    Par défaut
    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
     >> C
     
    C = 
     
        {9x1 cell}    {9x1 cell}    [9x1 double]    [9x1 double]    {9x1 cell}
     
    >> C{:}
     
    ans = 
     
        '1:gridsel(svm'
        '2:gridsel(svm'
        '3:gridsel(svm'
        '4:gridsel(svm'
        '5:gridsel(svm'
        '6:gridsel(svm'
        '7:gridsel(svm'
        '8:gridsel(svm'
        '9:gridsel(svm'
     
     
    ans = 
     
        'kernel'
        'kernel'
        'kernel'
        'kernel'
        'kernel'
        'kernel'
        'kernel'
        'kernel'
        'kernel'
     
     
    ans =
     
         8
         9
         8
         8
         8
        11
        12
        12
        10
     
     
    ans =
     
         8
         8
         8
         8
         8
         8
         8
         8
         8
     
     
    ans = 
     
        ')'
        ')'
        ')'
        ')'
        ')'
        ')'
        ')'
        ')'
        ')'

  10. #30
    Membre actif
    Inscrit en
    Novembre 2006
    Messages
    236
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 236
    Points : 213
    Points
    213
    Par défaut
    Si ça te convient, tant mieux

    Moi, j'obtiens ça :

    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
    >> fid = fopen('tata.txt');
    C = textscan(fid,'%f:gridsel(svm kernel rbf=%f C=%f) ');
    C{:}
    fclose(fid);
     
    ans =
     
         1
         2
         3
         4
         5
         6
         7
         8
         9
     
     
    ans =
     
         8
         9
         8
         8
         8
        11
        12
        12
        10
     
     
    ans =
     
         8
         8
         8
         8
         8
         8
         8
         8
         8
    MATLAB R2008a - Windows XP 32 bit et Windows Vista 64 bit

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. Problème matriciel avec fprintf
    Par jonathan86 dans le forum MATLAB
    Réponses: 1
    Dernier message: 06/03/2008, 06h46
  2. Réponses: 2
    Dernier message: 07/05/2007, 08h06
  3. Etrange problème avec un fprintf
    Par f56bre dans le forum C
    Réponses: 14
    Dernier message: 13/01/2007, 14h27
  4. problème de fprintf
    Par Andrey dans le forum C
    Réponses: 3
    Dernier message: 18/12/2006, 23h11

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