Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can't LOAD data(.dat) file into Matlab!

Status
Not open for further replies.

IndiJones

Full Member level 2
Full Member level 2
Joined
Aug 13, 2001
Messages
132
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
786
I have a simple tab spaced data file (data1.dat) and need to load it into Matlab. The dat file is like this for an example:
1 5.35
2 3.68
3 3.54
4 2.39
5 2.06
6 1.48
7 0.63
8 1.09
9 1.75
10 2.66
11 5.34
12 6.13

But whenever I write the command:

>> load data1.dat

I get the following error message:

QUOTE

??? Error: File: C:\MATLAB6p5p1\toolbox\compiler\load_mat\@char\load.m Line: 32 Column: 30
Missing operator, comma, semicolon, or white space.

UNQUOTE

Please note that all the paths to the directories have been correctly set. What could be wrong?
 

IndiJones said:
I have a simple tab spaced data file (data1.dat) and need to load it into Matlab. The dat file is like this for an example:
1 5.35
2 3.68
3 3.54
4 2.39
5 2.06
6 1.48
7 0.63
8 1.09
9 1.75
10 2.66
11 5.34
12 6.13

But whenever I write the command:

>> load data1.dat

I get the following error message:

QUOTE

??? Error: File: C:\MATLAB6p5p1\toolbox\compiler\load_mat\@char\load.m Line: 32 Column: 30
Missing operator, comma, semicolon, or white space.

UNQUOTE

Please note that all the paths to the directories have been correctly set. What could be wrong?

Hi, why you don't use IMPORT function (File -> Import data) ?
It works with no problem with formated text data, Excel etc..

Rgz

eirp
 

What's the use for the LOAD command if it doesn't work? By the way, I'm using version 6.5.1 Release 13.
 

Hi it is working for me. I am using Matlab 6.5.0.180913a (R13).
 

Hi IndiJones

Just type:
a=load('data1.dat')

This works too.
Cheers
 

variable=load('yourfile.dat','-ASCII');

you must be care that your file is in the actual path of MATLAB else you can write the omplete path:

variable=load('c:\program files\yourfile.dat','-ASCII');


neb,...
 

Thanks for your responses! I tried all those commands but still getting the same error. :(
 

Hi,
U get this error whenever the data file is not properly formatted. The example you have includes is not same as the file you are using. Check the data file. You will find the mistake.
BRMadhukar
 

Here's what I did. In my actual worksheet having four columns in Origin 7.5, I made a ASCII data file (data1.dat) with only spaces between the columns. I've uploaded the file for someone to be kind enough to check and tell me what's wrong with that. I can load the data file in Matlab using 'dlmread' or from the import wizard.
 

The problem might be with 6.5.1. I also installed 6.5.0 and the LOAD command was working!
 

IndiJones said:
The problem might be with 6.5.1. I also installed 6.5.0 and the LOAD command was working!

Tested now with 6.5.1

a=load('data1.dat')

and with your data and
WORKS!!
 

The load comand works w/ 6.0,6.1 & 6.5.
One other thing you might try is:
When you save your data do a "save as" choose
"text", "ASCII" or "RTF" and not "xls" or what ever
format your speadsheet saves as.

Cheers
 

Thanks all for your responses! I don't know why, but this LOAD command isn't working in my 6.5.1 R13 version. The data files were saved as txt & dat files. There's no problem with that. I guess it's time for me to get back to 6.5.0 again!
 

Hello all,

In all matlabs there is load function as built in.

The overloading of the built in function can be done in the directories started with @ for the given object.

in your workspace you can type which load and should get
load is a built-in function.

most probably you will get

.....\Matlab6p5sp1\toolbox\compiler\load_mat\@char\load.m

it means that you are in the .....\Matlab6p5sp1\toolbox\compiler\load_mat\@char directory or somehow the refferenece to the built in load has desappeard from the matlab core.
The built in functions are stored in the set of dlls....

dora
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top