跨列循环以存储插值

时间:2018-07-13 13:49:53

标签: matlab for-loop interpolation

我正在尝试插值2到end列之间所有列的值。 。我编写了一个代码,将所有Nans的所有插值值放入矩阵中。

例如:在列1中对应于自变量,在列2和3中对应于对象“ 32”的X和Y坐标。相似地,我想遍历所有列标题并放入插值。任何解决此问题的帮助将不胜感激。

const renderSectionHeader=({section: {title}}) => (
  <Text style={{fontWeight: 'bold'}}>{title}</Text>
 );

return (
        <SectionList
          renderItem={({item, index}) => <Text key={index}>{item}</Text>}
          renderSectionHeader={renderSectionHeader}
          sections={ticksData}
          keyExtractor={(item, index) => item + index}
        />;

错误:

data_to_be_interpolated = final_plot_matrix(:,2:end);
missing_part = zeros(length(data_to_be_interpolated,1),data_to_be_interpolated,2);
for ip = 1:1:data_to_be_interpolated
    missing_part(2:end,ip) = fillmissing(data_to_be_interpolated(2:end,ip),'linear','SamplePoints',data_to_be_interpolated(2:end,1));
end
missing_part(:,1) = data_to_be_interpolated(:,1);
missing_part(1,:) = data_to_be_interpolated(1,:);

任何帮助将不胜感激。

enter image description here

2 个答案:

答案 0 :(得分:0)

尝试一下。它将“ data_to_be_interpolated”值存储到第二列的missingpart矩阵中。

   data_to_be_interpolated = final_plot_matrix(:,:);
   missing_part = 
   zeros(size(data_to_be_interpolated,1),size(data_to_be_interpolated,2)-1);

   for ip = 1:size(missing_part,2)
   missing_part(:,ip) = data_to_be_interpolated(:,ip+1);
   end

答案 1 :(得分:0)

只需使用for循环遍历每一列。

missing_part = zeros(size(final_plot_matrix,1),size(final_plot_matrix,2));
for ip = 2:1:data_to_be_interpolated
    missing_part(2:end,ip) = fillmissing(final_plot_matrix(2:end,ip),'linear','SamplePoints',final_plot_matrix(2:end,1));
end
missing_part(:,1) = final_plot_matrix(:,1);
missing_part(1,:) = final_plot_matrix(1,:);

请记住,此final_plot_matrix应该是整个数据。