Illegal use of reserved keyword "global".
13 views (last 30 days)
Show older comments
I recently migrated a code based on GUIDE to Appdesigner, ran it many times, but at some part I started receiving this error message in the first 'global' : Parse error at GLOBAL: usage might be invalid MATLAB syntax.
and at Command Window: Error using plugin_App
Error: File: plugin_App.mlapp Line: 208 Column: 17
Illegal use of reserved keyword "global".
...
global val; %try to get the val from the slicer in the other button...
global unif_image;
unif_image(:,:,1) = dicom(:,:,(val-1));
unif_image(:,:,2) = dicom(:,:,val);
unif_image(:,:,3) = dicom(:,:,(val+1));
std_dicom_image= std(single(unif_image),0,3); %standard deviation of the 3 images
figure(3),
imagesc(std_dicom_image) %0 5000 %imshow(100*sqrt((std_dicom./mean_dicom).^2),'DisplayRange',[])
title('std')
mean_dicom_image= mean(single(unif_image),3); %average of 3 slices
figure(4),
imagesc(mean_dicom_image) %400 19000
title('averaged images')
...
Can someone help me to fix this error? I can't compile my app until fix this
2 Comments
Rik
on 24 Sep 2021
IS there a reason you're using global variables to share data between callbacks? Why aren't you using properties? Those are the equivalent of guidata fields in GUIDE.
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.
Answers (1)
Walter Roberson
on 24 Sep 2021
Notice the ... on the line above. You are using a continuation marker on a previous line so the global is not the first thing in the statement.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps 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!