Subscript indices must either be real positive integers or logicals?

前端 未结 1 1310
一个人的身影
一个人的身影 2021-01-26 12:09

I am trying to plot the results of my Matlab programme using a for loop which operates from 1 to 10 in increments of 0.1. However I am getting the following error when I attempt

相关标签:
1条回答
  • 2021-01-26 12:49

    You can use this simple trick: separate the value of TSR from the loop index.
    For example:

    TSRs = 1:.1:10
    for TSR_index = 1:numel(TSRs)
        TSR = TSRs( TSR_index );
        % continue your computation here using TSR
    
        % when saving values use TSR_index, e.g.:
        store_sigma(:,TSR_index)=sigma;
    
    end
    
    0 讨论(0)
提交回复
热议问题