sorting of my figures

1 次查看(过去 30 天)
21did21
21did21 2012-9-1
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 !
  4 个评论
Image Analyst
Image Analyst 2012-9-1
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.
per isakson
per isakson 2012-9-1
编辑:per isakson 2012-9-1
The short answer is that there are mistakes in the conditional expressions in the if-statements.
Proposal:
  1. provide a code which is possible copy&paste an run without guessing and fixing. (That cannot be done without testing.)
  2. describe what is displayed in figure 1 and what should be displayed
  3. and the same for figure 4
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!!!!!!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by