How to solve the Operator '-' is not supported for operands of type 'table'?

10 次查看(过去 30 天)
clc;
clear all;
close all;
format long g;
load('LS_inclination.mat')
%% Considering the 4corner or last column as z axis
z = LSinclination(:,5);
n = size(z,1);
% Computing the arithmetic mean or average value
%mean_value = mean(z);
mean(LSinclination{:,5});
intLogical = mod(LSinclination{:,5},1)==0 ;
mean_value= mean(LSinclination{intLogical,5});
% Computing the experimental variance and standard deviation
s2qk = sum((z-mean_value).^2)/(n-1);
sqk = sqrt(s2qk);
I have a data of laser scanner as attached and code file which shows some error mention in the comment. How can i fix it? Please explaing what does this error means?

采纳的回答

Duncan Po
Duncan Po 2021-6-14
z should be a matrix instead of a table. z is defined using parentheses indexing in your code:
z = LSinclination(:,5);
This returns a table. Later on, you try to do math on z, and in general math on tables are not supported. Instead, you want to use braces indexing to extract the data as an array:
z = LSinclination{:,5};

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by