1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // This file must be used under the terms of the CeCILL.
4 // This source file is licensed as described in the file COPYING, which
5 // you should have received as part of this distribution. The terms
6 // are also available at
7 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10 function [X,Y]=checkXYPair(typeOfPlot,x,y,current_figure,cur_draw_mode)
14 if type(y)==13 // If y is a function
16 if and(size(x)~=1) // then x *must* be a vector
17 ResetFigureDDM(current_figure, cur_draw_mode)
18 error(msprintf(gettext("%s: Wrong size for input argument #%d: A vector expected.\n"),typeOfPlot, 2));
23 t=x(:); // to ensure that t is a column vector
25 [nArgOut,vectInput]=check2dFun(typeOfPlot,f,t,current_figure,cur_draw_mode);
45 // CANNOT DO THE SAME WITH X(i) and Y(i)
46 // instead of xt and yt (scilab parser sees the stuff
55 else // "classical" case
60 if size(X,1)==1, X=X', end; // si l'un des vecteurs est une ligne
61 if size(Y,1)==1, Y=Y', end; // on le transpose.
65 ResetFigureDDM(current_figure, cur_draw_mode)
66 error(msprintf(gettext("%s: Wrong size for input argument #%d: A non empty matrix expected.\n"),typeOfPlot, 2));
72 ResetFigureDDM(current_figure, cur_draw_mode)
73 error(msprintf(gettext("%s: Wrong size for input argument #%d: A non empty matrix expected.\n"),typeOfPlot, 3));
77 if and(size(X)==size(Y)) then
78 // same size for X and Y
84 if (size(X,2)==1) & (size(Y,1)==size(X,1))
90 if (size(X,2)==1) & (size(Y,2)==size(X,1))
98 if (size(X,2) == 1) & (size(Y,2) == 1) & (size(Y,1) <> size(X,1)) ...
99 & (size(Y,1) ~= 1) then
100 // X and Y are vectors but not of same size
101 ResetFigureDDM(current_figure, cur_draw_mode)
102 error(msprintf(gettext("%s: Wrong size for input arguments #%d and #%d: Incompatible dimensions.\n"),typeOfPlot, 2, 3));
106 // new case : plot(MAT4x4,[1 2 3 4]) HERE Y is a vector and X a matrix
107 // Here Y is always a column vector
108 // extend y to be a 4x4 matrix defined as [1 1 1 1;2 2 2 2;3 3 3 3;4 4 4 4]
109 if or(size(Y) == 1) then
110 if size(X,1) == size(Y,1) then
112 elseif size(X,1) == size(Y,2) then
114 elseif size(X,2) == size(Y,1) then
117 elseif size(X,2) == size(Y,2) then
120 ResetFigureDDM(current_figure, cur_draw_mode)
121 error(msprintf(gettext("%s: Wrong size for input arguments #%d and #%d: Incompatible dimensions.\n"),typeOfPlot,2, 3));
125 // concatenante y in columns
126 Y=y(:,ones(1,size(X,2)));
133 ResetFigureDDM(current_figure, cur_draw_mode)
134 error(msprintf(gettext("%s: Wrong size for input arguments #%d and #%d: Incompatible dimensions.\n"),typeOfPlot, 2, 3));
141 // end of checkXYPair