フィルターのクリア

use parentheses. Otherwise, check for mismatched delimiters.

43 ビュー (過去 30 日間)
BOZHENG
BOZHENG 2023 年 1 月 30 日
コメント済み: Steven Lord 2023 年 1 月 30 日
i want to create gui caculator above is my coding
N1=get(handles.N1,'string');
N2=get(handles.N2,'string');
s1=get(handles.s1,'string');
s2=get(handles.s2,'string');
slope1=get(handles.slope1,'string');
slope2=get(handles.slope2,'string');
vm=get(handles.vm,'string');
k=(str2num(N1)/str2num(N2)*str2num(s1)/str2num(s2)*str2num(slope1)/str2num(slope2)^(1/3);
alpha=(k*str2num(s2)-str2num(s1)/((k-1)*vm);
set(handles.coefficient,'string',num2str(alpha));
but command window said Error: File: untitled3.m Line: 298
k=(str2num(N1)/str2num(N2)*str2num(s1)/str2num(s2)*str2num(slope1)/str2num(slope2)^(1/3);
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
what i should do thanks

採用された回答

Arif Hoq
Arif Hoq 2023 年 1 月 30 日
use the parentheses at the end of syntax.
k=(str2num(N1)/str2num(N2)*str2num(s1)/str2num(s2)*str2num(slope1)/str2num(slope2)^(1/3));
  3 件のコメント
Arif Hoq
Arif Hoq 2023 年 1 月 30 日
alpha=(k*str2num(s2)-str2num(s1))/((k-1)*vm);
Steven Lord
Steven Lord 2023 年 1 月 30 日
Let's count parentheses. Start with a count of 0. Every time you see ( add 1 to the count. Every time you see ) subtract 1. If you don't get back to 0 by the end of the line or if you ever get to -1 you have mismatched parentheses.
alpha=(k*str2num(s2)-str2num(s1)/((k-1)*vm);
% 0 1 2 1 2 1 23 2 1
You have one more ( than you do ). Where to add the missing ) depends on what you're trying to do.
alpha=(k*str2num(s2)-str2num(s1))/((k-1)*vm);
% 0 1 2 1 2 10 12 1 0
alpha=(k*str2num(s2)-str2num(s1)/((k-1)*vm));
% 0 1 2 1 2 1 23 2 10
alpha=(k*str2num(s2))-str2num(s1)/((k-1)*vm);
% 0 1 2 10 1 0 12 1 0

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by