This new instruction is a delight to use.
Simply open the Applications menu from the console window, select Import data at the bottom of the drop-down menu, then select the csv file you wish to process in SCILAB. The format is automatically detected, and the tool presents the file in an extremely user-friendly way.
To retrieve the data (in the form of tables, not matrices), simply click on the ‘play’ icon.
To create a script that will automatically retrieve the data so that it can be plotted on a graph, for example, simply click on the ‘notepad’ icon.
Now I’ll show you a personal example, with the recovered data formatted as a 4-window graph.
CSV file, named data.csv includes a column of 170 rows, with the data for each row separated by a comma. The first line contains the names of the 4 data items “Duration”, “Pulse”, “Maxpulse”, “Calories”. The other lines contain numerical values. Cf. below :
Now, here is the associated script automatically crated by SCILAB :
clear import_data;
function [data] = import_data(filename)
opts = detectImportOptions(filename, "Delimiter", ",", "Decimal", ".");
data = readtable(filename, opts, "VariableNames", ["Duration","Pulse","Maxpulse","Calories"]);
endfunction
data = import_data("C:\Users\Pascal\Documents\SciLab files\SCILAB from 2024 version\Exemple de lecture EXCEL\data.csv");
And I added some instructions to plot the data on a graph with 4 dedicated windows for each kind of data :
clf;
subplot(221)
plot(data.Duration,'b');
title("Duration");
xgrid;
gca().background=color("cyan");//set plot background color designed by its name
subplot(222);
plot(data.Pulse,'r');
title("Pulse");
xgrid(8);//set white grid
gca().background=color("black");//set plot background color designed by its name
subplot(223);
plot(data.Maxpulse,'g');
title("Maxpulse");
xgrid;
gca().background=color("gray50");//set plot background color designed by its name
subplot(224);
plot(data.Calories,'c');
title("Calories");
xgrid;
gca().background=color("peru");//set plot background color designed by its name
gcf().background=color("lightgray");//set figure background color designed by its name
And here is the corresponding graph:
I hope this demonstration is helpful.
Enjoy.