Invalid expression in function loading file

4 ビュー (過去 30 日間)
Owen Gray
Owen Gray 2021 年 1 月 24 日
コメント済み: Walter Roberson 2021 年 1 月 24 日
Hi I've written this function
function [RTxdone] = ReactionTime('resultsfile';sesid)
load 'resultsfile'
Rxtcell = ses(sesid)_results(5:800,6);
RTa = cell2mat(Rxtcell);
for n = 1:225
X = RTa(n:n+8);
Y = [0;0;0;0;0;0;0;0;0];
if X==Y
RTa(n) = NaN
end
end
RT = RTa(RTa~=0)
end
Which when I try to call gives this error:
Error: File: ReactionTime.m Line: 1 Column: 35
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
syntax error. To construct matrices, use brackets instead of parentheses.
Not sure what I've done here

回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 1 月 24 日
Same problem as in this recent post. See the answers provided there.
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 1 月 24 日
But also, parameters in a function definition must be separated by comma, never semi-colon.
Also,
Rxtcell = ses(sesid)_results(5:800,6);
is not valid syntax. When I look at that code, I have the suspicion that sesid is being used to pick out a particular variable name from the resultsfile. If that is the case, then that can generally be done, but not with that syntax, and we would need more details about what the sesid would look like and what the variable names in the file look like.

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

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by