Direct computation with Table
📄Description

You can perform calculations directly on tableswithout needing to index into them.

To perform such operations using the same syntax as you would for arrays, your tables must meet several criteria:

All variables within the table must have data types that support the intended calculations (e.g., numeric or logical types).

When performing an operation where only one operand is a table, the other operand must be either a numeric or logical array.

For operations involving two tables, they must have compatible sizes (i.e., the same number of rows and columns or the operation must make sense for the structures involved).

Below is an example that demonstrates how to perform calculations without explicitly indexing into the table.

💡Examples
Direct computation on Tables
% Create a sample table with sensor data
T = table([1.5; -2.3; 4.7], [0.5; 1.1; -0.7], [-1; 2; 3], ...
          'VariableNames', {'Voltage', 'Current', 'Resistance'});

% Apply functions directly to the table columns
abs(T)
acos(T)
acosh(T)
T > 1
T + 2
T .* T
abs(sin(T)) + 1
🔗See Also
absacosacoshacotacotdacothacscacscdacschasecasecdasechasinasindasinhatanatandatanhceilcosdcoshcospicotcotdcothcsccscdcschexpfixfloorloglog10log1plog2nextpow2roundsecsecdsechsinsindsinhsinpisqrttantandtanhvaracosdnotplusminustimeseqgegtleneltmrdividerempowerpow2ormodldivide
🕔Version History
Version Description
1.9.0 initial version
Edit this page on GitHub