Error: Unbalanced or unexpected parenthesis or bracket

4 vues (au cours des 30 derniers jours)
Ricardo Henriques
Ricardo Henriques le 11 Nov 2019
Commenté : Walter Roberson le 13 Nov 2019
The matlab show this error "Error: Unbalanced or unexpected parenthesis or bracket." in this part of the code:
%**************************************
nome = '105.txt';
[pathstr, name, ext] = fileparts(nome);
load(nome);
x=eval([name '(:,1)']);
y=eval([name '(:,2)']);
z=eval([name '(:,3)']);
%*************************************
---------------------------------------------------------------
105.txt contains 3 columns with several rows...
But on my friend's pc don't show this error... I have a Asus x64, with windows 10 and Matlab R2014b...
I think the problem is not from the code as it was functional on other pc's. I think it has to do with my compiler, but I don't know how to fix it ...
Already installed the version Matlab 6.5 R13, but the same error appears ...
What may be the source of this error?
  6 commentaires
Ricardo Henriques
Ricardo Henriques le 13 Nov 2019
So how should I replace the code?
Any suggestion?
Walter Roberson
Walter Roberson le 13 Nov 2019
Steven Lord showed you.

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 11 Nov 2019
I think name is variable, it's simply (there is no need for eval):
x = name(:,1);
y = name(:,2);
z = name(:,3);
  1 commentaire
Ricardo Henriques
Ricardo Henriques le 11 Nov 2019
The "name" came from of "[pathstr, name, ext] = fileparts(nome);"
The previous code is:
%********************************************
nome = '105.txt';
[pathstr, name, ext] = fileparts(nome);
load(nome);
x=eval([name '(:,1)']);
y=eval([name '(:,2)']);
z=eval([name '(:,3)']);
%***********************************************
105.txt contains 3 columns with several rows...

Connectez-vous pour commenter.

Plus de réponses (1)

Community Treasure Hunt

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

Start Hunting!

Translated by