簡體   English   中英

如何使用 matlab ZC1C425268E68385D14AB5074C17ZA 的設置 output 復雜的 plot

[英]How to output a complex plot with settings from a matlab function

我寫了一個 matlab 腳本,其中一部分是 plot

  graph = plot(fT, 'k', space, prediction_tactile);
  set(graph(1), 'Color', 'k','linestyle', 'none', 'Marker', 'o')
  set(graph(2),'linewidth',3);
  hold on
  graph_2 = plot(fV, 'r', space, prediction_visual);
  
  set(graph_2(1), 'Color','r','linestyle', 'none', 'Marker', 'o')
  set(graph_2(2),'linewidth',3);
 
  xline(rough_stimulus, '--k', {'Stimulus 1','roughness'});  
  xline(fine_stimulus, '--r', {'Stimulus 2','roughness'}); 
  legend('Stimulus_1 response data', 'Stimulus_1 response distribution', 'Stimulus_2 response data', 'Stimulus_2 response distribution')
  ylabel ('Probability', 'FontSize',16,'FontWeight','bold','Color','k')
  xlabel ('Arbitrary roughness space', 'FontSize',16,'FontWeight','bold','Color','k')
  title ('Perceived roughness simulation','FontSize',20,'FontWeight','bold')
 hold off 

現在我嘗試將腳本轉換為 function [figure,pC] = BCI_vic_att (noise)以循環運行(我需要多個繪圖)所以我有 output 25 個數字。 但是我完全困惑如何將 output 這個 plot 到工作區。 將非常感謝您的幫助

如果你有一個 for 循環,只需在你的代碼之前添加figure

for n=1:25

    figure(n)

        %your code 

end

不要使用figure作為變量名。 它是內置於 function 中的 matlab。

如果你堅持從你的腳本中制作一個 function,那么 function 的輸入是什么,除了圖之外,output 的輸入是什么? (有很多 plot 輸入有fTspaceprediction_tactile等......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM