From ee5bf4d90f78673d1e4d5a9dd304ee53c503c085 Mon Sep 17 00:00:00 2001 From: imushir Date: Tue, 9 Feb 2016 16:38:27 +0530 Subject: Support for Servo motor for Arduino. Support for'diag' in c --- macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci (limited to 'macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci') diff --git a/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci b/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci new file mode 100644 index 00000000..45d74c3a --- /dev/null +++ b/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci @@ -0,0 +1,30 @@ +function outsize =FA_SZ_COL_DIAG_IN_EX(insize,val) + +///////////////////////////////COLUMN SIZE FOR INSERT POSITION////////////////// + + + + if((insize(1) == '1')) // If ROW size is 1 + if(val == '0') then //For Oth position + outsize = insize(2); //COLUMN size is equal to COLUMN size + else // For ...-2,-1,1,2... position + outsize = string(eval(insize(2))+abs(eval(val)));// COLUMN size is equal to COLUMN size + absolute value of position(for 1*3 matrix and 2nd postion COLUMN size is (3+2)=5 + end + elseif((insize(2) == '1')) // If COLUMN size is 1 + if(val == '0') then //For Oth position + outsize = insize(1); //COLUMNS size is equal to ROW size + else // For ...-2,-1,1,2.... position + outsize = string(eval(insize(1))+abs(eval(val)));// COLUMN size is equal to ROW size + absolute value of position(for 3*1 matrix and 1st postion COLUMN size is (3+1)=4 + end +//////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////COLUMN SIZE FOR EXTRACT POSITION//////////////////// + + else + outsize = '1'; // For extract condition COLUMN size is always ONE. + end + +//////////////////////////////////////////////////////////////////////////////// + +endfunction -- cgit From 453598b49cb3d4a62b1797dbc90f0e3dd4521329 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Wed, 19 Apr 2017 11:56:09 +0530 Subject: Copyright message updated in added files and libraries separated in 'thirdparty' folder --- macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci | 39 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci') diff --git a/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci b/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci index 45d74c3a..8a313fee 100644 --- a/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci +++ b/macros/FunctionAnnotation/FA_SZ_COL_DIAG_IN_EX.sci @@ -1,6 +1,35 @@ function outsize =FA_SZ_COL_DIAG_IN_EX(insize,val) - -///////////////////////////////COLUMN SIZE FOR INSERT POSITION////////////////// +//function outsize =FA_SZ_COL_DIAG_IN_EX(insize,val) +// ----------------------------------------------------------------- +// Get size of column of the output for diag(insert) function +// +// Input data: +// insize: string specifying the size of input argument. +// val: string containing value of second input +// +// Output data: +// outsize: string containing the column size for output argument. +// +// Copyright (C) 2017 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Mushir +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// + +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +///////////////////////////////COLUMN SIZE FOR INSERT POSITION//////////////// @@ -8,13 +37,15 @@ function outsize =FA_SZ_COL_DIAG_IN_EX(insize,val) if(val == '0') then //For Oth position outsize = insize(2); //COLUMN size is equal to COLUMN size else // For ...-2,-1,1,2... position - outsize = string(eval(insize(2))+abs(eval(val)));// COLUMN size is equal to COLUMN size + absolute value of position(for 1*3 matrix and 2nd postion COLUMN size is (3+2)=5 + outsize = string(eval(insize(2))+abs(eval(val))); + // COLUMN size is equal to COLUMN size + absolute value of position(for 1*3 matrix and 2nd postion COLUMN size is (3+2)=5 end elseif((insize(2) == '1')) // If COLUMN size is 1 if(val == '0') then //For Oth position outsize = insize(1); //COLUMNS size is equal to ROW size else // For ...-2,-1,1,2.... position - outsize = string(eval(insize(1))+abs(eval(val)));// COLUMN size is equal to ROW size + absolute value of position(for 3*1 matrix and 1st postion COLUMN size is (3+1)=4 + outsize = string(eval(insize(1))+abs(eval(val))); + // COLUMN size is equal to ROW size + absolute value of position(for 3*1 matrix and 1st postion COLUMN size is (3+1)=4 end //////////////////////////////////////////////////////////////////////////////// -- cgit