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

10 ビュー (過去 30 日間)
vimal kumar chawda
vimal kumar chawda 2021 年 6 月 14 日
回答済み: Duncan Po 2021 年 6 月 14 日
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 Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by