hard figure sorting / management
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello world !
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 !
댓글 수: 2
Jan
2012년 8월 30일
Your code is very hard to read. Please follow the conventions in the forum and use code formatting. Thanks.
Oleg Komarov
2012년 8월 30일
Here's a .gif on how to format code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099
답변 (3개)
Christian Lenz
2012년 8월 30일
Generally your code slows down when you try to plot many points in one graph. Maybe you could try to plot only every other point?
The syntax would be:
plot( x(1:2:end) )
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!