[Scilab-users] CsvRead function
Jan Åge Langeland
j-lan at online.no
Tue May 12 13:41:29 CEST 2020
csvRead is quite strict regarding column structure etc, but the
associated error message is typical "can not read......". So when it
reports "does not exist", it looks like the file is missing, or
misplaced. If you still think the file is there, you may try this script
that I have used to check csv files:
//Read CSV file -JÅ 2020
datafile="test.csv";
separators=[ascii(9),";"];
decimal=",";
headerlines=2;
linestoread=-1;// -1 for all
footerlines=2;
fid = mopen(datafile,'rb');
csvline=mgetl(fid,linestoread);
mclose(fid);
clear dataset;
n=size(csvline,1);
for k=1:n
if k>headerlines && k<n-footerlines+1 then
datatemp=strtod(strsplit(csvline(k),separators),decimal);
dataset(k-headerlines,1:length(datatemp))=datatemp;
end
end
disp(csvline(1:headerlines))
disp(dataset)
disp(csvline(($-footerlines+1):$))
Jan
On 2020-05-12 10:20 AM, Daniel Stringari wrote:
> Good Morning,
>
> The file exists ... Every time the code is run, it tries to create a
> series of files inside the address "C: \ Temp \ PGC \ ..." using the
> functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and
> manipulate the data. This tool always worked in version 6.0.2 and when
> upgrading to version 6.1, it started to give an error with the code
> identical to the previous version, so my first suspicion was in
> relation to the mentioned functions.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200512/6afb5b11/attachment.htm>
More information about the users
mailing list