Error: Unbalanced or unexpected parenthesis or bracket

조회 수: 4 (최근 30일)
Ricardo Henriques
Ricardo Henriques 2019년 11월 11일
댓글: Walter Roberson 2019년 11월 13일
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
Ricardo Henriques
Ricardo Henriques 2019년 11월 13일
So how should I replace the code?
Any suggestion?
Walter Roberson
Walter Roberson 2019년 11월 13일
Steven Lord showed you.

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2019년 11월 11일
I think name is variable, it's simply (there is no need for eval):
x = name(:,1);
y = name(:,2);
z = name(:,3);
  댓글 수: 1
Ricardo Henriques
Ricardo Henriques 2019년 11월 11일
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...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by