I have been plotting my data by using "imshow" with "alpha" to make some objects to be more transparent. Everything has been working good. Never encountered problems before.
Like 10 minutes ago, when I processed and tried to plot my data. I got the error message like below:
"
Not enough input arguments.
Error in alpha (line 19)
alph = 1 + (z/d).^2 + Ax*(z/d).^3 + Bx*(z/d).^4;
"
I used this code the entire evening. Everything was good, but this error all of sudden started 10 minutes ago. The error persists in different PCs different MATLAB versions (2020b, 2021a) and different importing data.
Not sure what happened.

 Respuesta aceptada

DGM
DGM el 18 de Oct. de 2022

1 voto

I'm going to go out on a limb here and suggest that you likely have another function file called alpha.m somewhere on the path. The file for alpha() which would be used for setting graphics object transparency has a large enough synopsis that it wouldn't have any sort of code on line 19.
You can check to see if there are conflicting files by using which():
which alpha -all
If there's an unintended alpha.m on the path, either rename it or move it off the path.
If my guess is mistaken, then I'm going to have to ask if you can you provide an example of the code which replicates the problem?

2 comentarios

Yen-Cheng Chen
Yen-Cheng Chen el 18 de Oct. de 2022
Thank you for the suggestions! I checked the path and found there's another alpha.m in the path, and when I removed it, everything works well again. My bad! I totally missed it.
Image Analyst
Image Analyst el 18 de Oct. de 2022
Then please go ahead and click the "Accept this answer" link to award @DGM "reputation points" for helping you, and let people know it's now solved. Thanks in advance. 🙂

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 18 de Oct. de 2022
Editada: Image Analyst el 18 de Oct. de 2022

1 voto

What is the size of the Ax, Bx, z, and d variables? try taking it one term at a time
clc
size(Ax)
size(Bx)
size(z)
size(d)
term1 = (z/d) .^ 2
term2 = Ax * (z/d) .^ 3
term3 = Bx * (z/d) .^ 4
alph = 1 + term1 + term2 + term3
Let me know where it bombs, and everything you see in the command window.
Also, let us know how alpha and alph are related. "alph" is obviously a variable, but where do you declare or mention alpha?

1 comentario

Yen-Cheng Chen
Yen-Cheng Chen el 18 de Oct. de 2022
I imported another other codes and it happened to have another alpha.m in the path. When I removed it, everything works well again.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 18 de Oct. de 2022

Comentada:

el 18 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by