필터 지우기
필터 지우기

Prevent figure frame from popping up

조회 수: 3 (최근 30일)
Sophie Lis
Sophie Lis 2018년 5월 7일
댓글: Ameer Hamza 2018년 5월 7일
I am trying to prevent the figure from popping up at all (including the frame itself when initialized) and it is not working.
num = 0;
for n = 1:endblock
fig = figure(n);
for block = 1:endblock
name = sprintf('Idx_%d',n);
index = Sort.Sort.(name)(block).avg;
num = num + size(Sort.Sort.(name)(block).block,2);
tvec = 1:97;
avg = cell2mat(index);
set(fig, 'Visible', 'off');
plot(tvec,avg,'Color',[1 0 1/block]);
xlabel('Time (min)');
ylabel('Mean Voltage (V)');
title(['Idx' num2str(n)]);
hold on
end
legend(['Blocks = ' num2str(endblock),' Waveforms = ' num2str(num)]);
print(['Idx ' num2str(n)],'-dpng');
num = 0;
end
end

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 7일
You are turning off the visibilioty very late, until then the figure is already created. What you need to do is to turn it off at creation. They following code will turn off the visibility of all figures before at creation so they will not steal focus. And when the processing is done, the final for loop will turn on the visibility again
num = 0;
fig = cell(1, endblock);
for n = 1:endblock
fig{n} = figure('Visible', 'off');
for block = 1:endblock
name = sprintf('Idx_%d',n);
index = Sort.Sort.(name)(block).avg;
num = num + size(Sort.Sort.(name)(block).block,2);
tvec = 1:97;
avg = cell2mat(index);
plot(tvec,avg,'Color',[1 0 1/block]);
xlabel('Time (min)');
ylabel('Mean Voltage (V)');
title(['Idx' num2str(n)]);
hold on
end
legend(['Blocks = ' num2str(endblock),' Waveforms = ' num2str(num)]);
print(['Idx ' num2str(n)],'-dpng');
num = 0;
end
for i=1:length(fig)
fig{i}.Visible = 'on';
end
  댓글 수: 2
Sophie Lis
Sophie Lis 2018년 5월 7일
Thank you so much!
Ameer Hamza
Ameer Hamza 2018년 5월 7일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by