フィルターのクリア

Error using sum Dimension argument must be a positive integer scalar, a vector of unique positive integers, or 'all'.

50 ビュー (過去 30 日間)
I am attempting to do this calculation:
VRTemp=((sum(ATretreive{1,7:10})/4)*100)-273;
But I then receive this error:
Error using sum
Dimension argument must be a positive integer scalar, a vector of unique positive integers, or 'all'.
I first use:
ATdata=uitable(uifigure,'ColumnName',{'Test date'; 'Accel S/N' ;'Accel_0' ;'Accel_90'; 'Accel_180'; 'Accel_270';...
'Temp_0' ;'Temp_90'; 'Temp_180' ;'Temp_270'},'Data',ATdatac);
ATretreive= get(ATdata,'Data');
in order to obtain and extract the data.
How should I correct this error?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 8 日
sum(ATretreive{1,7:10})
ATretrieve is a cell . Using index {1,7:10} is cell expansion, and is going to produce a comma-separated list, just as if you had invoked
sum(ATretreive{1,7}, ATretreive{1,8}, ATretreive{1,9}, ATretreive{1,10})
That is too many non-option arguments for sum()
I suspect what you want is
mean(cell2mat(ATretrieve(1,7:10)), 2) * 100 - 273
but you need to figure out whether you want the sum to be by row or by column; the version with mean() here is by row under the guess that the division by 4 corresponds to division by number of columns.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by