Use parametric Name generator to adress existing cell arrays

1 visualización (últimos 30 días)
Hello,
I generated 36 cell arrays as I need to evaluate a lot of files for my masters thesis. The files are named myself and conain infos about temperature, material etc.
So build a name-generator for me to store the values in the right cell array.
My question is, how can I use a name I created as a pathname?
SED_B_S235_M20 = cell(1,4), 'VariableNames', {'Filename','FORCE_Stress','ZERO_Stress','NumberOfCycles'};
% and so on.. so the parts are:
AssMeth='SED';
Geo='B';
Steel='S235';
Temp='M20';
%of course there are much more; just shortened for it to work
TableName= sprintf('%s_%s_%s_%s', AssMeth,Geo,Steel,Temp)
TableName = 'SED_B_S235_M20' is the right output and I have a Cell array called exactly the same. How do write e.g. 1234 into the first row and the first coloum of the cell array using "TableName".
Using TableName(1,1)=1234 obiously does not work and I don't know what command I need to look for.
Thank very much in advance!

Respuesta aceptada

Jeff Miller
Jeff Miller el 1 de Mzo. de 2019
One almost-convenient way to do this is to put all of your cell arrays within a structure, call it 'a'.
So, for example, create your first cell array within this structure like this:
a.SED_B_S235_M20 = cell(1,4), 'VariableNames', {'Filename','FORCE_Stress','ZERO_Stress','NumberOfCycles'};
% and so on..
Now you can refer to that component of the structure by putting the string in parentheses, something like this:
TableName= sprintf('%s_%s_%s_%s', AssMeth,Geo,Steel,Temp);
a.(TableName)(1,1) = 1234; % Should this be {1,1} with curly brackets since it is a cell?

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by