Looping with MATLAB Tables

1 次查看(过去 30 天)
I have 10 different MATLAB Tables in my workspace. I wish to do the same operation to the 10 Table variables. I have written the code for 1 Table variable. Now I am wondering whether can I use a for loop to complete my work. But I don't know how to use a for loop for Table variables. Please help me.
%% Datasets from Experiments
load dataset
%% Finding BHP
%converting velocity from knots to m/s
v_ms = dataset7.v_k * 0.5144;
%converting outside air temperature(oat) from celcius to kelvin
oat_k = dataset7.oat_c + 273.15;
%finding brake horse power
bhp = (dataset7.rpm .* dataset7.mp_hg * Ts * rHP) ./ (rrpm * rmp * oat_k);
This is my code. The dataset file has 10 Tables like dataset1, dataset2 etc.

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2020-11-21
Steps:
  1. Load files Link
  2. Save the results v_ms,oat_k,bhp in array or cell array as per result data type
load tables
v_ms(i)=zeros(1,length(tables_number));
oat_k(i)=zeros(1,length(tables_number));
bhp(i)=zeros(1,length(tables_number));
for i=1:length(tables_number)
%read first TABLE
filename=readtable(..); % Please refer the above link to call one by one file
v_ms(i)=
oat_k(i)=
bhp(i)=
end
I preseumed that, the v_ms,oat_k,bhp results are in single data(scaler), hence I used array here. If the results are any other types, please use cell array. In such case case you just to replace () with {}.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by