hard figure sorting / management

1 回表示 (過去 30 日間)
21did21
21did21 2012 年 8 月 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
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
Oleg Komarov 2012 年 8 月 30 日

サインインしてコメントする。

回答 (3 件)

Christian Lenz
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) )

21did21
21did21 2012 年 8 月 30 日
hello, i know that my code is hard to read :( the problem is that "code" don't works with me :( => perhaps can you copy and paste my code in one text editor to have a nice form ?
the problem here is not a slows down problem. The problem is that some point are plotted in the graph where i don't want them :(
i think is a bad using of "hold on" or my condition that are not good

21did21
21did21 2012 年 8 月 31 日
Ok, my can code can be read now ;) => thanks Oleg for your link :)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by