怎么在matlab中进行逻辑判断

学习和分享。

东西/原料

  • 电脑
  • matlab软件

方式/步调

  1. 1

    if ~isempty(get(groot,'CurrentFigure'))     %若是现有的窗口没有图

    disp('There are existing figures.')         %显示There are existing figures

    else    

    disp('There are no existing figures.')   %显示There are no existing figures

    end

    0dd7912397dda1440d3de4ebbdb7d0a20cf486b7.jpg
  2. 2

    if ~isempty(findobj('Tag','myFigures'))    

        disp('There are objects with this tag.')  

                %显示There are objects with this tag

    else    

        disp('There are no objects with this tag.')

                %显示There are no objects with this tag

    end

    a1ec08fa513d26973fd780045afbb2fb4316d867.jpg
  3. 3

    if isgraphics(h,'figure')    

      disp('h is a valid figure handle.')

    else    

      disp('h is not a valid figure handle.')

    end

    1c950a7b02087bf45debdfb0fdd3572c11dfcf60.jpg
  4. 4

    if isequal(h,groot)    

      disp('h is the root handle')

    else    

      disp('h is not the root handle')

    end

    a50f4bfbfbedab642b74c599f836afc379311e60.jpg
  5. 5

    p = plot(magic(3)); 

    par = get(p,'Parent'); 

    objarray = [par{:}]'; 

    whos objarray

    023b5bb5c9ea15cebaf76850b9003af33a87b24a.jpg35a85edf8db1cb139a42b44ad254564e92584b44.jpgd000baa1cd11728bbd2b047bc7fcc3cec3fd2c61.jpg7a899e510fb30f2459b0645ac795d143ad4b0344.jpg
  6. 6

    p1 = plot(1:10); 

    p2 = p1; 

    p2 == p1

    6a600c338744ebf86570ec66d6f9d72a6059a762.jpg55e736d12f2eb9382c6cf2abda628535e5dd6f62.jpg8cb1cb13495409230871eb279d58d109b3de494b.jpg
  7. 7

    l1 = line; 

    l2 = line; 

    isequal(l1,l2)

    8b82b9014a90f6034ab0141e3612b31bb051ed63.jpgf3d3572c11dfa9ecd735de4e6dd0f703918fc154.jpg500fd9f9d72a6059a13569432734349b033bba46.jpg
  8. 8

    t = num2str(rand); 

    fh = @(t) text(1,1,t); 

    th = cellfun(fh,{t},'UniformOutput',false);

    810a19d8bc3eb135d1c73fe2a91ea8d3fd1f4463.jpgd31b0ef41bd5ad6ed7faecb38ecb39dbb6fd3c63.jpg8326cffc1e178a828f26f7f9f903738da977e855.jpg10dfa9ec8a1363273dee4a6a9e8fa0ec08fac76c.jpg

原作者:matlab举报

  • 发表于 2020-03-08 20:55
  • 阅读 ( 300 )
  • 分类:其他类型

相关问题

0 条评论

请先 登录 后评论