使用saveas进行绘图时出错

时间:2015-03-10 18:59:52

标签: matlab plot

当我尝试在MATLAB中保存绘图时,我收到此错误:

??? Operands to the || and && operators must be convertible to logical scalar values.

Error in ==> saveas at 64
    while ~isempty(h) &&  ~isfigure(h)

Error in ==> LongDistanceHistogram at 155
     saveas(p, ['hotspot-histograms/ddi' num2str(ddi_ctr) '.png']);

我的情节代码如下所示,错误发生时会显示正确显示情节的窗口:

 clf;
 nums = [wrongratio truthratio];
 [counts, centers] = hist(nums,20);
 p = bar(centers, counts);
 hold on;
 title(['DDI ' num2str(ddi_ctr)]);
 xlabel('% increase in score from long-distance information');
 ylabel('Count');
 legend('Random sampling', 'Fixed M_i states', 'Location', 'Northwest');
 saveas(p, ['hotspot-histograms/ddi' num2str(ddi_ctr) '.png']);     

有谁知道什么是错的?当我在做线图时,这工作正常,但我尝试改为条形似乎打破了它。

0 个答案:

没有答案