Error while creating a table from cell
Ältere Kommentare anzeigen
I have cell containing tables with variables Frequnacy and Mode values, Now i want to create a table where each column represent frequancy and a raw has values of mode for all 48 cells.
something like this.

% Extract frequency values from the first table of Mode_shape
freq_values = Mode_shape{1}.freq;
% Preallocate the output cell array
output_cell = cell(size(freq_values));
% Loop over the frequency values and extract the corresponding Mode values
for i = 1:length(freq_values)
% Find the index of the table that matches the current frequency value
freq_index = find([Mode_shape{:}].freq == freq_values(i), 1);
% Extract the mode values from the matching table
mode_table = Mode_shape{freq_index}.mode;
% Assign the mode table to the output cell array, using the frequency value as the table name
output_cell{i} = array2table(mode_table, 'VariableNames', {'Mode'}, 'RowNames', {'Node 1', 'Node 2', 'Node 3'});
output_cell{i}.Properties.VariableUnits{'Mode'} = 'm';
output_cell{i}.Properties.Description = sprintf('Mode shape for frequency %.2f Hz', freq_values(i));
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!