Importdata problem

4 views (last 30 days)
Xenxo
Xenxo on 24 Mar 2012
Hello, I´d like to do a GUI thtat shows two differents lines. Each line is represented throw a file.dat.
First, I look for the library, and I have:
uigetdir --> library='C:\Users\Jhon\Desktop\';
handles.Library=library;
After, I must choose a file:
if hObject==handles.one
file='Data\file1.dat';
elseif hObject==handles.two
file='Data\file2.dat'
end
handles.File=file;
Then
Library=handles.Library
File=handles.File
Direction=strcat(Library,'\',File)
a=importdata(Direction)
m=a.data;
axes(handles.axes1);
plot(m(:,1),m(:,2),'bo-')
But I have a problem:
Direction=
'C:\Users\Jhon\Desktop\Data\file1.dat'
and importdata don´t works.
If I write: Direction='C:\Users\Jhon\Desktop\Data\file1.dat', matlab will show:
Direction= C:\Users\Jhon\Desktop\Data\file1.dat --> (there aren´t '')
and importdata works.
What can I do?
  1 Comment
Oleg Komarov
Oleg Komarov on 24 Mar 2012
Please format the code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

Sign in to comment.

Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!