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

10 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Duncan Po
Duncan Po el 14 de Jun. de 2021
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};

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by