I dont understand this error in line 653 and the end goal is to make a graph
3 views (last 30 days)
Show older comments
Hi Guys hopefully some of you guys can help. im pretty new to Matlab 2020a and do not have much experience.
i have entered the following code into my live script : (i have attached and shorten verision of the Sep_Consibio Cloud Datalog.csv in this question)
%% Raw data plot for Septemper
% Data import
tic
opts = delimitedTextImportOptions("NumVariables", 4);
% Specify range and delimiter
opts.DataLines = [1, Inf];
opts.Delimiter = ",";
% Specify column names and types
opts.VariableNames = ["Timestamp", "Date", "H2SIn", "H2SOut"];
opts.VariableTypes = ["double", "datetime", "double", "double"];
% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Specify variable properties
opts = setvaropts(opts, "Date", "InputFormat", "dd/MM-yy HH:mm:ss");
% Import online measurement data from Consibio
ConsibioSepdatalog = readtable("Users\amil\Documents\MATLAB\Rawdata2022\Sep_Consibio Cloud Datalog.csv", opts);
ConsibioSepdatalogTrimNew = ConsibioSepdatalog(:,:);
toc
Unable to find or open 'Users\amil\Documents\MATLAB\Rawdata2022\Sep_Consibio Cloud Datalog.csv'. Check the path and filename or file permissions. --> however the document is in the same folder as the live script --> i how give my file permission? I'm an apple user and have a MacBook Air (13-inch, 2017) 8 GB 1600 MHz DDR3, icore 5.
the goal is to use the Rawdata in a plot where the x-axis is time [dd.mm.hh.mm:ss] and y- axis is for the concenctration in and out of H2S [ppm]
- if you have any suggestion for this part of the code please comment :)
0 Comments
Accepted Answer
Image Analyst
on 12 Apr 2023
Since the file is in the same folder as the m-file, you can do
fullFileName = fullfile(pwd, 'Sep_Consibio Cloud Datalog.csv');
if ~isfile(fullFileName)
errorMessage = sprintf('File not found:\n"%s"\nCheck the spelling.')
uiwait(errordlg(errorMessage));
return;
end
% If you get here, the file exists.
fprintf('Processing "%s".', fullFileName)
ConsibioSepdatalog = readtable(fullFileName, opts);
4 Comments
Image Analyst
on 13 Apr 2023
Yes. So it must have found it. Since it did, it would have printed it out to the command window. If you want a popup message you can do
fullFileName = fullfile(pwd, 'Sep_Consibio Cloud Datalog.csv');
if ~isfile(fullFileName)
errorMessage = sprintf('File not found:\n"%s"\nCheck the spelling.')
uiwait(errordlg(errorMessage));
return;
end
% If you get here, the file exists.
message = sprintf('Success! Found the file!\nNow processing "%s".', fullFileName);
fprintf('%s\n', message); % Print to command window.
uiwait(helpdlg(message)); % Pop up a dialog box with the same info.
ConsibioSepdatalog = readtable(fullFileName, opts);
More Answers (2)
Alan Stevens
on 12 Apr 2023
Get rid of the gaps between Consibio and Cloud, and between Cloud and Datalog (In the file name and when calling it).
2 Comments
Image Analyst
on 12 Apr 2023
What about my answer below? Did you try that? It will alert you if the file does not exist.
Walter Roberson
on 12 Apr 2023
ConsibioSepdatalog = readtable("C:\Users\amil\Documents\MATLAB\Rawdata2022\Sep_Consibio Cloud Datalog.csv", opts);
You omitted the drive and leading \ . When you omit the leading \ then you are asking to look in a directory named Users inside your current folder
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!