Error using () Subscripting into a table...
Show older comments
Hi all, just updated to R2023 in order to use the "combinations" function, and all of sudden another section of my code no longer works. It seems like Matlab is misinterpreting "dot(" (for dot product) as a variable? I provides this error message:
Error using ()
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as
in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).
Error in dot (line 29)
a = a(:);
Error in hw4_problem4 (line 41)
dot( ...
I haven't named any variable as dot, obviously. The code for this section is below.
for n = 1:(number_of_vectors)
for o = 1:(number_of_slip_directions)
for p = 1:(number_of_slip_planes)
schmid_factor(n,o,p) = ( ...
dot( ...
stress_vectors(n,:), ...
slip_planes(p,:) ...
) ...
/ ...
sqrt( ...
dot(stress_vectors(n,:),stress_vectors(n,:)) ...
* ...
dot(slip_planes(p,:),slip_planes(p,:)) ...
) ...
)...
*...
( ...
dot( ...
stress_vectors(n,:), ...
slip_directions(o,:) ...
)...
/ ...
sqrt( ...
dot(stress_vectors(n,:),stress_vectors(n,:)) ...
*...
dot(slip_directions(o,:),slip_directions(o,:)) ...
) ...
);
end
end
end
1 Comment
JORDAN
on 17 Oct 2023
Accepted Answer
More Answers (1)
Line 29 of the dot.m included with MATLAB doesn't match what you showed. MATLAB Answers uses release R2023b (Update 2, but I don't believe dot.m has changed in the 23b Update releases.)
version
dbtype 25:35 dot.m
I suspect you've defined your own dot.m that's taking precedence over the one included with MATLAB. To check, see what this command displays:
which -all dot
2 Comments
Walter Roberson
on 17 Oct 2023
MATLAB Version: 23.2.0.2365128 (R2023b)
has the call to with a(:) at line 29 of toolbox/matlab/specfun/dot.m
Hmm. You're right. Ah, I'm guessing that dbtype call displayed a different dot.m than I expected.
dbtype 25:35 toolbox/matlab/specfun/dot.m
It looks like instead dtype displayed the overload of dot for tall arrays.
dbtype 1:5 dot.m
Categories
Find more on Stress and Strain in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!