Page 1 of 1

Import Data to Matlab

Posted: Tue Jun 25, 2019 3:01 am
by STAR
Dear James,
I wanted to import the muse csv data to the Matlab, and followed the steps you provided on the website. But when running the syntax, an error (Error: File: mmImport.m Line: 1 Column: 46) and invalid syntax were shown on the command window and the editor. respectively. Could you please help me solve this problem? Thank you.

Star

Re: Import Data to Matlab

Posted: Tue Jun 25, 2019 3:24 am
by James
Don't edit the script, just run the command.
Change the first line back to

Code: Select all

function [museData, museElements] = mmImport(fileName)
Then run the command in the command line to import.

Re: Import Data to Matlab

Posted: Tue Jun 25, 2019 4:01 am
by STAR
Dear James,
as you can see, I change the first line back to [museData, museElements] = mmImport(fileName), and run the command. But there was also an error (Error in mmImport (line 10)) shown on the screen. Please kindly help me that! Many thanks.

Star

Re: Import Data to Matlab

Posted: Tue Jun 25, 2019 4:04 am
by STAR
Dear James,
as you can see, I change the first line back to [museData, museElements] = mmImport(fileName), and run the command. But there was also an error (Error in mmImport (line 10)) shown on the screen. Please kindly help me that! Many thanks.

Star

Re: Import Data to Matlab

Posted: Tue Jun 25, 2019 8:21 am
by James
You need to update MatLab, sorry.

According to the MatLab documentation, detectimportoptions requires at least version R2016b:
https://www.mathworks.com/help/matlab/r ... tions.html

Re: Import Data to Matlab

Posted: Wed Jul 03, 2019 4:44 am
by dedalus
I have the same error with MATLAB R2018a

[museData, museElement] = mmImport('museMonitor_2019-07-03--09-05-48.csv')
Undefined function or variable 'delimitedTextImportOptions'.

Error in mmImport (line 10)
opts = delimitedTextImportOptions('VariableNames',varNames,...

>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.4.0.813654 (R2018a)
MATLAB License Number: 40426278
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 17763)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Re: Import Data to Matlab

Posted: Wed Jul 03, 2019 9:40 am
by James
Sorry, I'm not sure why you're getting that error.
According to the docs, the delimitedTextImportOptions function was introduced in R2016b, so it should work fine with your version.

I checked through the release notes and there was a change in R2018a, which notes "Use property name DataLines instead of DataLine."

https://www.mathworks.com/help/matlab/r ... ortOptions

As you're using R2018a, so you shouldn't need to do anything. Maybe try changing it from DataLines to DataLine (line 14) and see if that fixes it?

The best thing to do would be to upgrade though. For reference, I tested the script with R2019a.

Re: Import Data to Matlab

Posted: Fri Jul 05, 2019 4:09 am
by dedalus
Thank you. Just updated to 2019a. I am sure it will work. Cheers