Hello world ! i come back with a previous problem, but now my question is more clear :)
i have a problem with the management of my figures. It's difficult for me to find why my programm don't works welll. So, can you see please where is the problem. thanks!!!!!!
my data i have a array that is like this :
Piece{1,1}='A1';Piece{1,2(1,1)='X';
Piece{1,3}=25;Piece{1,4}=15;Piece{1,5}=25;
Piece{2,1}='A1';Piece{2,2}(1,1)='X';
Piece{2,3}=100;Piece{2,4}=15;Piece{2,5}=25;
Piece{3,1}='BB';Piece{3,2}(1,1)='Z';
Piece{3,3}=300;Piece{3,4}=15;Piece{3,5}=25;
Piece{4,1}='A1';Piece{4,2}(1,1)='X';
Piece{4,3}=400;Piece{4,4}=0.5;Piece{4,5}=25;
Piece{4,2}(2,1)='Y';
Piece{5,1}='BB';Piece{5,2}(1,1)='X';
Piece{5,3}=400;Piece{5,4}=15;Piece{5,5}=25;
Piece{5,2}(2,1)='Y';
Piece{6,1}='A1';Piece{6,2}(1,1)='X';
Piece{6,3}=400;Piece{6,4}=70;Piece{6,5}=25;
Piece{6,2}(2,1)='Y';
each line of my cell contrain information about an industrial piece.
column 1: state of the piece (two possibilities : A1 or BB) column 2: type of curve that i want to use for this piece (X,Y ou Z axis) several choice are possible. next column: values for X,Y,Z (allow to put values on different curves)
*I want *: i want 6 types of curve : 1°) state A1 curve X 2°) state A1 curve Y 3°) etat A1 curve Z 4°) state BB curve X 5°) state BB curve Y 6°) etat BB curve Z
if my piece "i" (line i of cell) is a state A1 and contrain in case 2 X and Y i have to put a point on figure 1°) et 2°). if my piece "i" (line i of cell) is a state BB and contrain in case 2 Z i have to put a point just in figure 6°)...
this is my code
Etat{1}='A1';Etat{2}='BB'; typeCourbe{1}='X'; typeCourbe{2}='Y';
typeCourbe{3}='Z';
for i=1:length(Etat)
for j=1:length(typeCourbe)
countFig=countFig+1;
figure (countFig)
hold on
for k=1:nbPieces
if( any(typeCourbe{j}==Pieces{k,2}(:,1)) && any(Etat{i}==Pieces{k,1})
if (typeCourbe{j}==typeCourbe{1})
plot(Pieces{k,3},longeurPiece(k),'om')
end
if (typeCourbe{j}==typeCourbe{2})
plot(Pieces{k,4},longeurPiece(k),'om')
end
if typeCourbe{j}==typeCourbe{3}
plot(Pieces{k,5},longeurPiece(k),'om')
end
end
end
end
end
problem : => this code works well except for figures 1 and 4.
=> these figures have to many point!
Do you know why i have this problem ?
thanks for your help !
No products are associated with this question.
4 Comments
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/47172#comment_97023
I copied and pasted and had a syntax error. I fixed that one and then another one popped up. I don't know how long it would go on so I quit. Please post code that will run.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/47172#comment_97044
The variables
are not assigned values.
This assignment is easier to read
Piece = { 'A1' 'X' 25 15 25 'A1' 'X' 100 15 25 'BB' 'Z' 300 15 25 'A1' ('XY')' 400 0.5000 25 'BB' ('XY')' 400 15 25 'A1' ('XY')' 400 70 25 };Is there a reason to define Piece{4:6,2} as columns of strings? Rows are easier to type and read.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/47172#comment_97062
sigh. Even with per's fix, it just bombs on the rest of 21did212's code. I hate having to fix code that is unrelated to the question, just to get to the part related to the question. So I won't.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/47172#comment_97069
The short answer is that there are mistakes in the conditional expressions in the if-statements.
Proposal:
I think a code, which first calculates the data to be displayed and in the next step presents the data, would be easier to debug. The data to be displayed should be assigned to variables with good names.
Is this question identical to your question hard figure sorting / management ? thanks!!!!!!