Importdata Command not accepting input argument

2 vues (au cours des 30 derniers jours)
Margarita
Margarita le 3 Juin 2014
Commenté : Niklas Nylén le 4 Juin 2014
Hello, Well I know this should be a pretty simple task, but I have been unable to use the importdata command. what I have is this
>> FILENAMES{j}
ans =
'L1S11_0_0.mat'
>> importdata(FILENAMES{j})
??? Error using ==> importdata at 136
Unable to open file.
The file is there because when I use the command in this way
>> importdata('L1S11_0_0.mat')
ans =
cycles: 0
load: 0
comment: 'Baseline'
condition: 'Baseline'
path_data: [1x252 struct]
straingage_data: [1x1 struct]
XRay_data: [1x1 struct]
It works perfectly.
I have +100 files to import and I cant simply write the names manually each time with every importdata command.
Can you say what could I be doing wrong?
By the way: I am using Matlab R2010a
Thanks
  1 commentaire
Margarita
Margarita le 4 Juin 2014
Modifié(e) : Margarita le 4 Juin 2014
when I run the line
strcmp(FILENAMES{j}, 'L1S11_0_0.mat')
It returns a "0". They should be the same so why is matlab taking them as different? (The difference is in the presence or lack of the '' sign)

Connectez-vous pour commenter.

Réponses (1)

Niklas Nylén
Niklas Nylén le 3 Juin 2014
Filenames seems to be a cell of cells, you can tell from ans being 'L1S11_0_0.mat' rather than just L1S11_0_0.mat. This should work:
importdata(FILENAMES{j}{1})
  7 commentaires
Margarita
Margarita le 4 Juin 2014
Modifié(e) : Margarita le 4 Juin 2014
Any ideas of how could I refer this problem? Matlab is not taking the variables to have the same value (FILENAMES and 'L1SS1_0_0')
Niklas Nylén
Niklas Nylén le 4 Juin 2014
what happens if you run
exist(FILENAMES{j}{1},'file')

Connectez-vous pour commenter.

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by