Is that possible to assemble several options and pass to the plot function in matlab

前端 未结 4 544
死守一世寂寞
死守一世寂寞 2021-01-20 00:58

I am using matlab to plot several figures and hope these figure use the same plot options. To be more specific, it looks something like this.

N = 20;
Fs = 20         


        
4条回答
  •  遥遥无期
    2021-01-20 01:26

    Using a cell with the options was already a good approach. Just use {:}, as below:

    opt = {'bs-', 'MarkerFaceColor', 'b', 'LineWidth', 3};
    figure(1),clf;
    subplot(311);
    plot(t, x, opt{:});
    

    Then, each element of the cell is evaluated as single argument.

提交回复
热议问题