Salut.
J'ai cree une fonction dont je voudrais qu'elle me donne 4 matrices en argument de sortie. Or cela ne marche pas. "ans" donne par matlab correspond a la premiere matrice uniquement.

Je ne vois pas d'ou peut venir le probleme. Mes matrices contiennent parfois des NaN.

Dans mon script, matlab souligne en orange mes arguments de sortie avec le message " nom_matrice produces a value that appears to be unused"

Voila mon code, un peu long desole :

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
 
 
function [column triangle square diamond] = times_all_files_statistics         
rep = pwd;                  
ext = '*.log';
chemin = fullfile(rep,ext);
list = dir(chemin);
column=[];
triangle=[];
square=[];
diamond=[];
w=1;
x=1;
y=1;
z=1;
 
for i=1:length(list)
    [A,B,C,D] = textread(list(i).name,'%d%d%d%*22[^\n]%s','delimiter','\n','headerlines',95);
 
    if length(A)>19
        s=20;
        o = 'Data: 0x0 0x0 0x0 0x0 0x0 0x0 ';
 
        while s<length(D) & strcmp(o,D(s))==1                   
              s=s+1;
        end
        timetofind=A(s);
 
        a=length(A);
        s=length(D);
        while s>1 & strcmp(o,D(s))==1                  
              s=s-1;
        end
        timetocomeback=A(a)-A(s);
 
        timehovering = A(a)-timetofind-timetocomeback;
        if timetofind > 0 & timehovering > 0 & timetocomeback > 0
            times(i,1) = timetofind;
            times(i,2) = timehovering;
            times(i,3) = timetocomeback;
            times(i,4) = A(a);
        else
            times(i,1) = NaN;
            times(i,2) = NaN;
            times(i,3) = NaN;
            times(i,4) = NaN;
        end
    else
            times(i,1) = NaN;
            times(i,2) = NaN;
            times(i,3) = NaN;
            times(i,4) = NaN;
    end
 
 
 
    if strfind(list(i).name,'column')==1
        column(w,:)=[times(i,1) times(i,2) times(i,3) times(i,4)];
        w=w+1;
    end
    if strfind(list(i).name,'triangle')==1
        triangle(x,:)=[times(i,1) times(i,2) times(i,3) times(i,4)];
        x=x+1;
    end
    if strfind(list(i).name,'square')==1 | strfind(list(i).name,'suqare')==1
        square(y,:)=[times(i,1) times(i,2) times(i,3) times(i,4)];
        y=y+1;
    end    
    if strfind(list(i).name,'diamond')==1
        diamond(z,:)=[times(i,1) times(i,2) times(i,3) times(i,4)];
        z=z+1;
    end    
end
    column;
    triangle;
    square;
    diamond;