hard figure sorting / management
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Jan
el 30 de Ag. de 2012
Your code is very hard to read. Please follow the conventions in the forum and use code formatting. Thanks.
Oleg Komarov
el 30 de Ag. de 2012
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
Respuestas (3)
Christian Lenz
el 30 de Ag. de 2012
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 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!