Why is the same variable displayed colored and uncolored?

5 次查看(过去 30 天)
The struct D is displayed with green color until it suddenly (row 562) loses its green color and things go wrong after that.
I have attached an image thats shows the described issue and the entire matlab code
This is a script from a functional magnetic resonance imaging reconstruction tool where I have removed the graphical user interface so that I may run it on a computation cluster that is a linux server
edit: I have also attached the version of the script where the GUI has not yet been removed
  2 个评论
Star Strider
Star Strider 2020-7-21
It loses its green colour because it is inside the ‘zo_pb_cb’ function. Functions have their own workspaces. Also, varargin does not result in any arguments being aubsequently assigned (at least in the code image). Those are the problems. You need to define the solutions.
I am not posting this as an Answer because it is not one. However it may lead you to a solution.

请先登录,再进行评论。

采纳的回答

Cris LaPierre
Cris LaPierre 2020-7-21
There is a warning associated with the blue D. Hover over it to see.
I suspect the issue is that you have accidentally included subfunctions inside the first function. I'm not familiar with your code, but perhaps try inserting the closing "end" for the function defined on line 1 at line 162. This removes any color difference from all instances of D.
I think you will also need to remove the "end" from what is now line 558. There appears to be an extra indent in this function, which may be causing visual confusion.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by