Import Data to Matlab

Post Reply
STAR
Posts: 3
Joined: Mon Jun 24, 2019 11:50 pm

Import Data to Matlab

Post 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
Attachments
error.png
error.png (211.32 KiB) Viewed 17599 times
User avatar
James
Site Admin
Posts: 1103
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import Data to Matlab

Post 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.
STAR
Posts: 3
Joined: Mon Jun 24, 2019 11:50 pm

Re: Import Data to Matlab

Post 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
STAR
Posts: 3
Joined: Mon Jun 24, 2019 11:50 pm

Re: Import Data to Matlab

Post 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
Attachments
error2.png
error2.png (209.84 KiB) Viewed 17591 times
User avatar
James
Site Admin
Posts: 1103
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import Data to Matlab

Post 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
dedalus
Posts: 2
Joined: Wed Jul 03, 2019 4:42 am

Re: Import Data to Matlab

Post 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
User avatar
James
Site Admin
Posts: 1103
Joined: Wed Jan 02, 2013 9:06 pm

Re: Import Data to Matlab

Post 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.
dedalus
Posts: 2
Joined: Wed Jul 03, 2019 4:42 am

Re: Import Data to Matlab

Post by dedalus »

Thank you. Just updated to 2019a. I am sure it will work. Cheers
Post Reply