How to Prevent Matlab Printing False Space and Use Wrong Fonts

The close(gcf) command awaiting the return key

The problem comes from the closerequestfcn property of the graphic object. The currently distributed art.m script contains this line:

set(handles.figure1,'closerequestfcn',['try,if isunix,txt=''rm ''; else txt=''del ''; end; [nill,ok]=system([txt,''',fullfile(output_dir,art_mask_temporalfile),''']);catch;end;close(gcbf);']);

This is a very elegant way to remove temporary files when the ART window is closed, but on my linux station, I have an alias for interactively remove the files or the directories (alias rm 'rm -i') ... So when the Art tool is running on an linux station with this configuration, the close(gcf) command awaits for an interactive action ... So, If you encounter this symptom, changing the previous line by the following should fix:

set(handles.figure1,'closerequestfcn',['try,if isunix,txt=''rm -f ''; else txt=''del ''; end; [nill,ok]=system([txt,''',fullfile(output_dir,art_mask_temporalfile),''']);catch;end;close(gcbf);']);

It could be a good idea that the next version of ART tool include this very minor change ...

How do I change the Fontweight of Table Titles in MATLAB?

I believe that you are mixing things up: the documentation page that you referenced refers to tables displayed in Matlab GUI (using the uitable function), and its FontWeight property refers to the font-weight of the internal data elements displayed in that table.

This is apparently entirely unrelated to what you're actually doing, which is to use a non-GUI data table, such as one that is created using the table function. Such a table is an object which uses an internal overload of the disp function in order to display the table contents in the Matlab console (Command Window). This overloaded disp function displays the table headers using the HTML <Strong> tag. You can see the full source code in matlabroot/toolbox/matlab/datatypes/@tabular/disp.m, and the part that adds the strong tag around line 45.

In short, if you want table output not to use a strong tag in its header, you need to either modify that file, or create your own class that inherits the table tablular class and overloads the disp function in whatever way that you wish.

Addendum: I just discovered an even simpler way:

feature('HotLinks',0);  % temporarily disable bolded headers (matlab.internal.display.isHot=false)
disp(myTable)
feature('HotLinks',1); % restore the standard behavior (matlab.internal.display.isHot=true)

Is it possible to make the whole work in one loop?

You should warp everything in a function like:

function rxPlot(r,x)
A = (r+1./r)./4;
G = zeros(length(A),length(x));
R = zeros(length(A),length(x));

for k=1:length(x)
R(:,k) = ((r+1./r)-2)./((r+1./r)+x(k));
B = (1-(x(k)/2)^2)^-0.5;
NUM = 2 + (0.5.*x(k).*(r+1./r));
DUM = (r- 1./r ).*(1-(x(k)/2)^2)^0.5;
C = EA(NUM./DUM);
G(:,k) = A.*B.*C;
end
plot(r,G,'Linewidth',3)
xlabel('$r$','Interpreter','latex','FontSize',18)
ylabel('$G=\gamma P_P L$','Interpreter','latex','FontSize',18)
title('Gain vs r for different values of D/sqrt(M)')
legend('0','-0.1','-1','-1.5','0.5','1.5','1')

figure;
plot(R,G,'Linewidth',3)
xlabel('$\sigma_0$','Interpreter','latex','FontSize',18)
ylabel('$G=\gamma P_P L$','Interpreter','latex','FontSize',18)
title('Gain vs r for different values of D/sqrt(M)')
legend('0','-0.1','-1','-1.5','0.5','1.5','1')
end

And then simply call it with your input:

r = 1:0.1:20;
x = [0 -0.1 -1 -1.5 0.5 1.5 1];
rxPlot(r,x)

Is this works as needed?



Related Topics



Leave a reply



Submit