Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
This repository is a test toolbox for Scilab. It requires "thirdparty" directory which can be downloaded as "external-library.zip" file from the page: https://scilab.in/fossee-scilab-toolbox. The "thirdparty" directory contains compiled library for a simple "multiplication" function written in C. After copying the "thirdparty" directory to the toolbox directory, on the scilab console run "exec builder.sce" to build the toolbox and then run "exec loader.sce" to load the toolbox. Type "help" in the scilab console and browse through the help content of "test_toolbox". The external-library.zip file also contains separate instructions to work with MinGW on Windows OS.
Documentation by : Gursharan Kaur, as part of FOSSEE semester long Internship Screening task by IIT Bombay for Scilab toolkit optimization.

This repository is a test toolbox for Scilab. It requires "thirdparty" directory which can be downloaded as "external-library.zip" file from the page: https://scilab.in/fossee-scilab-toolbox. The "thirdparty" directory contains compiled library for a simple "transpose" function written in C. After copying the "thirdparty" directory to the toolbox directory, on the scilab console run "exec builder.sce" to build the toolbox and then run "exec loader.sce" to load the toolbox. Type "help" in the scilab console and browse through the help content of "test_toolbox". The external-library.zip file also contains separate instructions to work with MinGW on Windows OS.

This toolbox overall demonstrates:

1. A C function that computes transpose of a nxm matrix with file named as “trans.c”.

2. A main file to call the C function.

3. A shell script with a series of commands to compile and execute the “trans.c” and “main.c” file.

4. Folder named “test” inside the repository containing “trans.c” file , “main.c” and working shell script file inside it.

This toolbox overall demonstrates
1. How to add a function defined in C in scilab
2. How to add a function defined in Scilab in Scilab
3. How to write help for the added functions
4. How to create a toolbox out of the above functions.
32 changes: 32 additions & 0 deletions test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include<stdio.h>
#include"trans.h"

int main()
{
int n,m,i,j;
printf("Enter Rows and Columns: ");
scanf("%d %d",&n,&m);
int a[100][100];
printf("\nEnter array: ");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf("%d ",&a[i][j]);
}
printf("\n");
}
int t[100][100];
transpose(n,m,a,t);

printf("\nTranspose of the matrix:\n");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
printf("%d ", t[i][j]);
}
printf("\n");
}
return 0;
}
4 changes: 4 additions & 0 deletions test/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gcc main.c
./a.out

//Shell script to execute the main.c
13 changes: 13 additions & 0 deletions test/trans.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include<stdio.h>

int transpose(int n,int m,int a[][100],int t[][100])
{
int i,j;
for(j=0;j<m;j++)
{
for(i=0;i<n;i++)
{
t[i][j]=a[j][i];
}
}
}
6 changes: 6 additions & 0 deletions test/trans.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef TRANS_DOT_H
#define TRANS_DOT_H

void transpose(int n,int m,int a[][100],int t[][100]);

#endif