フィルターのクリア

Invalid expression. Check for missing or extra characters.

55 ビュー (過去 30 日間)
Jonas Damsbo
Jonas Damsbo 2018 年 11 月 19 日
回答済み: sudirman 2023 年 7 月 26 日
Hi
When I run my code I got an error message "Invalid expression. Check for missing or extra characters" for my if loop.
I am not sure why. Someone there can help me?
GHGS = (zx(:,[151+[-1 0 1]])-zx(:,[131+[-1 0 1]]))/20;
GHGN = (zx(:,[171+[-1 0 1]])-zx(:,[151+[-1 0 1]]))/20;
for i=1:nx
if
GHGS > 0
fprintf('The point is blocked')
elseif
GHGN < -10
fprintf('The point is blocked')
else
blocks(i)=blocks(i)+1;
end
end
  1 件のコメント
Adam
Adam 2018 年 11 月 19 日
編集済み: Adam 2018 年 11 月 19 日
At a guess I would say it comes from splitting your if condition across 2 linies, though I haven't tested it.
Try
if GHGS > 0
all on one line instead.
You can split code across multiple lines, but it need the first line to end with ... to show that the same statement continues on the next line, otherwise Matlab will expect a complete statement on the first line.

サインインしてコメントする。

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 19 日
編集済み: madhan ravi 2018 年 11 月 19 日
GHGS = (zx(:,[151+[-1 0 1]])-zx(:,[131+[-1 0 1]]))/20;
GHGN = (zx(:,[171+[-1 0 1]])-zx(:,[151+[-1 0 1]]))/20;
for i=1:nx
if GHGS > 0 %change your lines to this as one line
fprintf('The point is blocked')
elseif GHGN < -10 %change your lines to this as one line
fprintf('The point is blocked')
else
blocks(i)=blocks(i)+1;
end
end

その他の回答 (6 件)

KALIVARAPU Rama Kumara Teja
KALIVARAPU Rama Kumara Teja 2019 年 12 月 11 日
編集済み: KALIVARAPU Rama Kumara Teja 2019 年 12 月 11 日
The equation is in .mlx file and I saved as .m file to paste the code(syntex) for .mfile execution. facong below error :
% Mutual Inductance
g = 1.3 ; % constant value for square shape.
n1 = 5 ; % number of turns in primary coil
n2 = 4 ; % number of turns in secondary coil
r_i = % radius of ith turn in primary coil
r_j = % radius of jth turn in secondary coil
d_12 = 30 ; % distance between coils,mm
M=g\sum_{i=1}^{n1}\sum_{j=1}^{n2}(M_ij,r_i,r_j,d_12)
> squarecoil
Error: File: squarecoil.m Line: 53 Column: 44
Invalid expression. Check for missing or extra characters.
Can someone help me for the above equation ?
  1 件のコメント
Adam
Adam 2019 年 12 月 11 日
編集済み: Adam 2019 年 12 月 11 日
sum_{i=1}
is not valid syntax. At least I'm pretty sure it isn''t!

サインインしてコメントする。


swapna subudhiray
swapna subudhiray 2020 年 10 月 2 日
clear
close all
clc
load X_Gabor_feat
load Y
X=X_Gabor_feat;
clear X_Gabor_feat
for i=1:10
per=70;
c=cvpartition(Y,'HoldOut',1-(per/100));
train_loc=c.training;
test_loc=~train_loc;
X_train=X(train_loc,:);
Y_train=Y(train_loc,:);
X_test=X(test_loc,:);
Y_test=Y(test_loc,:);
Mdl=fitcknn(X_train,Y_train);
[obt_class,~]=predict(Mdl,X_test);
[oa(i), aa(i), K(i), ua(:,i)]=perf_measure(Y_test,obt_class);
end
disp('OA : mean std');
[mean(oa);std(oa)]
disp('AA : mean std');
[mean(aa);std(aa)]
disp('K : mean std');
[mean(K);std(K)]
disp('UA :');
mean(ua')
getting invalid erroe expression..please help me out

sudirman
sudirman 2023 年 7 月 26 日
blinking
Error: File: blinking.m Line: 2 Column: 11
Invalid expression. Check for missing or extra characters.

sudirman
sudirman 2023 年 7 月 26 日
blinking
Error: File: blinking.m Line: 2 Column: 11
Invalid expression. Check for missing or extra characters.

sudirman
sudirman 2023 年 7 月 26 日
>> blinking
Error: File: blinking.m Line: 2 Column: 11
Invalid expression. Check for missing or extra characters.

sudirman
sudirman 2023 年 7 月 26 日
>> blinking
Error: File: blinking.m Line: 2 Column: 11
Invalid expression. Check for missing or extra characters.
papan = arduino();
dipimpin =

カテゴリ

Help Center および File ExchangeModel Verification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by