Adding border to table

16 Ansichten (letzte 30 Tage)
Abbey Kirkman
Abbey Kirkman am 25 Feb. 2021
Hi how would i go about adding a simple solid border to the table produced frim the following code below?
[filename1,pathname1]=uigetfile('*.xlsx','Pick your Data1 file');
if filename1~=0
data_1=readmatrix(fullfile(pathname1,filename1),'Range',17);
data1=data_1(:,4:37)
h={' Speed' 'Torque' 'TORQUE.ECE' 'POWER' 'ECE_power' 'BMEP' 'Correction_factor' 'Coolant_Temperature_Out_of_Engine' 'Coolant_Temperature_Into_Engine' 'Coolant_Pressure' 'Fuel_Pressure' 'Fuel_Temperature' 'Specific_Fuel_Consumption' 'Inlet_Air_Temperature' 'Humidity' 'Barometric_Pressure' 'Test_Cell_Temperature' 'Exhaust_Temperature_in_CAT' 'Exhaust_Temperature' 'Lambda' 'Exhaust_Pressure' 'Inlet_Manifold_Pressure' 'Blowby' 'Pedal_Position' 'IgnRetCyl1' 'IgnRetCyl2' 'IgnRetCyl3' 'IgnRetCyl4' 'ECU_Pedal_Position' 'Ignition_Timing' 'ThrottleAngle' 'Coolant_Temperature_ECU' 'Oil_Pressure_Head' 'Sump_Oil_Temperature'};
DATA1=[h;num2cell(data1)]
else
data1=0;
end
%%Loading data2 data
[filename2,pathname2]=uigetfile('*.xlsx','Pick your Data 2 file');
if filename2~=0
data_2=readmatrix(fullfile(pathname2,filename2),'Range',17);
data2=data_2(:,4:37)
h={' Speed' 'Torque' 'TORQUE.ECE' 'POWER' 'ECE_power' 'BMEP' 'Correction_factor' 'Coolant_Temperature_Out_of_Engine' 'Coolant_Temperature_Into_Engine' 'Coolant_Pressure' 'Fuel_Pressure' 'Fuel_Temperature' 'Specific_Fuel_Consumption' 'Inlet_Air_Temperature' 'Humidity' 'Barometric_Pressure' 'Test_Cell_Temperature' 'Exhaust_Temperature_in_CAT' 'Exhaust_Temperature' 'Lambda' 'Exhaust_Pressure' 'Inlet_Manifold_Pressure' 'Blowby' 'Pedal_Position' 'IgnRetCyl1' 'IgnRetCyl2' 'IgnRetCyl3' 'IgnRetCyl4' 'ECU_Pedal_Position' 'Ignition_Timing' 'ThrottleAngle' 'Coolant_Temperature_ECU' 'Oil_Pressure_Head' 'Sump_Oil_Temperature' };
DATA2=[h;num2cell(data2)]
else
data2=0;
end
%%Loading data3 data
[filename3,pathname3]=uigetfile('*.xlsx','Pick your data 3 file');
if filename3~=0
data_3=readmatrix(fullfile(pathname3,filename3),'Range',17);
data3=data_3(:,4:37)
h={' Speed' 'Torque' 'TORQUE.ECE' 'POWER' 'ECE_power' 'BMEP' 'Correction_factor' 'Coolant_Temperature_Out_of_Engine' 'Coolant_Temperature_Into_Engine' 'Coolant_Pressure' 'Fuel_Pressure' 'Fuel_Temperature' 'Specific_Fuel_Consumption' 'Inlet_Air_Temperature' 'Humidity' 'Barometric_Pressure' 'Test_Cell_Temperature' 'Exhaust_Temperature_in_CAT' 'Exhaust_Temperature' 'Lambda' 'Exhaust_Pressure' 'Inlet_Manifold_Pressure' 'Blowby' 'Pedal_Position' 'IgnRetCyl1' 'IgnRetCyl2' 'IgnRetCyl3' 'IgnRetCyl4' 'ECU_Pedal_Position' 'Ignition_Timing' 'ThrottleAngle' 'Coolant_Temperature_ECU' 'Oil_Pressure_Head' 'Sump_Oil_Temperature' };
DATA3=[h;num2cell(data3)]
else
data3=0;
end
%%Loading data 4 data
[filename4,pathname4]=uigetfile('*.xlsx','Pick your Data 4 file');
if filename4~=0
data_4=readmatrix(fullfile(pathname4,filename4),'Range',17);
data4=data_4(:,4:37)
h={' Speed' 'Torque' 'TORQUE.ECE' 'POWER' 'ECE_power' 'BMEP' 'Correction_factor' 'Coolant_Temperature_Out_of_Engine' 'Coolant_Temperature_Into_Engine' 'Coolant_Pressure' 'Fuel_Pressure' 'Fuel_Temperature' 'Specific_Fuel_Consumption' 'Inlet_Air_Temperature' 'Humidity' 'Barometric_Pressure' 'Test_Cell_Temperature' 'Exhaust_Temperature_in_CAT' 'Exhaust_Temperature' 'Lambda' 'Exhaust_Pressure' 'Inlet_Manifold_Pressure' 'Blowby' 'Pedal_Position' 'IgnRetCyl1' 'IgnRetCyl2' 'IgnRetCyl3' 'IgnRetCyl4' 'ECU_Pedal_Position' 'Ignition_Timing' 'ThrottleAngle' 'Coolant_Temperature_ECU' 'Oil_Pressure_Head' 'Sump_Oil_Temperature' };
DATA4=[h;num2cell(data4)]
else
data4=0;
end
%%Loading data 5 data
[filename5,pathname5]=uigetfile('*.xlsx','Pick your Data 5 file');
if filename5~=0
data_5=readmatrix(fullfile(pathname5,filename5),'Range',17);
data5=data_5(:,4:37)
h={' Speed' 'Torque' 'TORQUE.ECE' 'POWER' 'ECE_power' 'BMEP' 'Correction_factor' 'Coolant_Temperature_Out_of_Engine' 'Coolant_Temperature_Into_Engine' 'Coolant_Pressure' 'Fuel_Pressure' 'Fuel_Temperature' 'Specific_Fuel_Consumption' 'Inlet_Air_Temperature' 'Humidity' 'Barometric_Pressure' 'Test_Cell_Temperature' 'Exhaust_Temperature_in_CAT' 'Exhaust_Temperature' 'Lambda' 'Exhaust_Pressure' 'Inlet_Manifold_Pressure' 'Blowby' 'Pedal_Position' 'IgnRetCyl1' 'IgnRetCyl2' 'IgnRetCyl3' 'IgnRetCyl4' 'ECU_Pedal_Position' 'Ignition_Timing' 'ThrottleAngle' 'Coolant_Temperature_ECU' 'Oil_Pressure_Head' 'Sump_Oil_Temperature' };
DATA5=[h;num2cell(data5)]
else
data5=0;
end
if data1~=0
max3_1=max(data1(:,3));
max5_1=max(data1(:,5));
else
max3_1=0;
max5_1=0;
end
if data2~=0
max3_2=max(data2(:,3));
max5_2=max(data2(:,5));
else
max3_2=0;
max5_2=0;
end
if data3~=0
max3_3=max(data3(:,3));
max5_3=max(data3(:,5));
else
max3_3=0;
max5_3=0;
end
if data4~=0
max3_4=max(data4(:,3));
max5_4=max(data4(:,5));
else
max3_4=0;
max5_4=0;
end
if data5~=0
max3_5=max(data5(:,3));
max5_5=max(data5(:,5));
else
max3_5=0;
max5_5=0;
end
Max_values=[max3_1,max3_2,max3_3,max3_4,max3_5]'
Max_values1=[max5_1,max5_2,max5_3,max5_4,max5_5]'
max_values = string(Max_values);
max_values1 = string(Max_values1);
for i = 1:numel(max_values)
max_values(i) = sprintf('%.1f',max_values(i));
max_values1(i) = sprintf('%.1f',max_values1(i));
end
Table =table({filename1;filename2;filename3;filename4;filename5},max_values,max_values1)
Table.Properties.VariableNames = {'Filenames' ,'Max ECE Torque','Max ECE Power'}
  1 Kommentar
Abbey Kirkman
Abbey Kirkman am 1 Mär. 2021
any help would be appreciated

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Anshika Chaurasia
Anshika Chaurasia am 2 Mär. 2021
Hi Abbey,
I would suggest you to use uitable that will create table user interface component.
The code provided by you generate Table. You can use following code snippet to create a table UI component:
fig = uifigure;
uit = uitable(fig,'Data',Table);
Hope it helps!

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by