Getting Error while using Transparency to object (alpha)

3 ビュー (過去 30 日間)
Telema Harry
Telema Harry 2023 年 1 月 13 日
コメント済み: Telema Harry 2023 年 1 月 14 日
I get the following error ("Unable to use a value of type matlab.graphics.chart.primitive. Surface as an index. alpha(s,.2)") message sometimes and I don't know why?
r = 50; % The radius of the circular plan given in Km
r = km2deg(r); % Convert to Degree
[X,Y,Z] = cylinder(r);
p0=[48,278,0]; % base location in Degrees
X=X+p0(1); Y=Y+p0(2); Z=Z+p0(3); %translate cylinder to new location
h = 80;
Z = Z*h;
subplot(2, 2, [1 3])
s = surf(Y,X,Z,'FaceColor','#80B3FF', 'EdgeColor','none');
% view(43,180);
% camdolly(0,0,0)
alpha(s,.2)
I am using MATLAB R2022a on a macOS ventura 13.1 machine.

採用された回答

Voss
Voss 2023 年 1 月 14 日
編集済み: Voss 2023 年 1 月 14 日
You have a variable called "alpha" in your workspace, which is preventing you from running the "alpha" function.
You should remove the variable by running the command
clear alpha
on the command line, and then run your script again.
  1 件のコメント
Telema Harry
Telema Harry 2023 年 1 月 14 日
I did not think of that. Thank you @Voss.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by