what is the map in this example?
2 次查看(过去 30 天)
显示 更早的评论
when I try to run this code in MATLB, it doesn't work in which showing cant find the variable of map for colormap(map). does anyone know what the map is here?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1577087/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1577087/image.png)
1 个评论
Dyuman Joshi
2023-12-27
移动:Dyuman Joshi
2023-12-29
The variable map is part of the file mri.mat -
%Check the file location
which mri.mat
load mri.mat
%check the contents loaded into the workspace (ignore cmdout)
whos
A generally preferred is to load the data into a variable -
out = load('mri.mat')
回答(2 个)
DGM
2023-12-27
编辑:DGM
2023-12-27
Ah. This is one of the hazards of using load() like this.
When you run the line
load mri
... you're loading the contents of mri.mat into memory. Three new variables magically appear in the workspace without ever being declared anywhere in the code.
One of the three is the variable called map. It is an 89x3 gray colormap. The map is almost perfectly linear and full-scale, so if you really wanted to, it would probably suffice to replace it with gray(89), but that shouldn't be necessary. Check to make sure you're loading mri.mat and that the contents are showing up in the workspace.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!