'下午,我一直在将数据加载到我拥有的脚本中,并且想让文件的名称成为图形的标题(或者只是在可见的文本中)。我想不通,任何建议表示赞赏....我正在运行的代码是:
%% File selection
[fileName, pathName] = uigetfile({'*_SUMMARY.mat' 'MAT-files (*_SUMMARY.mat)'}, 'Load Data', '.');
if pathName == 0, error('No file selected'), end
load(fullfile(pathName,fileName))
%% Intercept and gradient
%-------c---------m------]
FR = [0.6051, -1.9666e-05;... % zero
0.60429, -1.8295e-05;... % 60
0.60576, -2.1043e-05;... % 120
0.60311, -1.5683e-05]; % 180
N = numel(FR(:,1));
% x-axis limits
x = linspace(1,1000,N)'; % Vector of [N] equally spaced points in range 0:1000
% End position as scalar value
idx = 102; % Get data for sheet 102
V = 1:numel(SheetInkThickness(1,:)); % vector for 'x' values
FinalSheetSum = sum(SheetInkThickness(idx,:)); % sum
average = mean(SheetInkThickness(idx,:)); % mean
ActMinusAve = (SheetInkThickness(idx,:)-average).^2; % (Act-Ave).^2
sumActMinusAve = sum(ActMinusAve); % Sum of Act-Ave
SheetInkProperties = [V', (SheetInkThickness(idx,:))', ActMinusAve']; % matrix for storing ink sheet properties
[maxActMinusAve, idmaxActMinusAve] = max(ActMinusAve); % max of ActMinusAve
[minActMinusAve, idminActMinusAve] = min(ActMinusAve); % min of ActMinusAve
[maxSIT, idmaxSIT] = max(SheetInkThickness(idx,:));
[minSIT, idminSIT] = min(SheetInkThickness(idx,:));
[maxSIT2, idmaxSIT2] = max(ActMinusAve);
[minSIT2, idminSIT2] = min(ActMinusAve);
[p, S] = polyfit(V', SheetInkProperties(:,2),1);
[y,delta] = polyval(p,V',S);
StDev = std(SheetInkThickness(idx,:));
diff1 = (maxSIT-average); % Difference between max and average
diff2 = (average-minSIT); % Difference between min and average
if diff1>diff2; % Find which difference is greater
difference = diff1;
else difference = diff2;
end
%% Sheet ink thickness
fh5 = figure(5);
clf
hold on
grid on
subplot(2,2,3:4)
plot(V, ActMinusAve, 'b.-');
text(0.45, 0.9, ['maximum: ', num2str(maxSIT2)],...
'units','normalized')
text(0.45, 0.85, ['minimum: ', num2str(minSIT2)],...
'units','normalized')
text(0.45, 0.8, ['System length: ', num2str(Sum.Total_Length),' (mm)'],...
'units','normalized')
text(0.45, 0.75, ['Number of rollers: ', num2str(Sum.NoOfRollers+1)],...
'units','normalized')
text(0.45, 0.7, ['Number of nips: ', num2str(Sum.NoOfNips)],...
'units','normalized')
text(0.9, 0.85, {'{\it\Sigma(x-{\itxmean)^2} = }',...
num2str(sumActMinusAve)},'units','normalized');
title('{\it(x-{\itxmean)^2}}');
xlabel('segments on sheet');
ylabel('ink thickness');
% Lower figure
subplot(2,2,1:2)
plot(V, SheetInkThickness(idx,:))
hold on
plot(V, average,'r-');
text(V(1,end),average,'average');
text(0.45, 0.9, ['average: ', num2str(average)],...
'units','normalized')
text(0.45, 0.85, ['difference: ', num2str(difference)],...
'units','normalized')
text(0.45, 0.8, ['Standard deviation: ', num2str(StDev)],...
'units','normalized')
text(idmaxSIT, maxSIT, ['\leftarrow max = ',num2str(maxSIT)]);
text(idminSIT, minSIT, ['\leftarrow min = ',num2str(minSIT)]);
title('sheet ink thickness')
xlabel('sheet length (segments)');
ylabel('ink thickness (um)');
是的,我知道这很混乱,当然有机会循环/矢量化其中的一些代码,但这是一项正在进行的工作。谁能指出我解决问题的正确方向?谢谢理查德