How to name by checking the entrys of a table?

1 回表示 (過去 30 日間)
Vincent Kelber
Vincent Kelber 2018 年 11 月 15 日
再開済み: madhan ravi 2018 年 11 月 17 日
Hi Guys, i I'm new in matlab so i need a little help to get started.
What i'm doning is to use the fullfact Method to create a table. There are 5 columns then and 216 rows. The number of factors depends - let me show you:
diameter=[ 10 15]; % diameter in mm
density=[ 0 50 100]; % density in percent
orientation=[ 0, 45, 90]; % orientaion in degree
seam=[0,1]; % 0 align, 1 random (can be adjusted to strings if really wanted)
layheight=[ 0.2 0.3 0.4]; % layheigth in mm
contournumbers=[1 2]; % numbers of contours
What i want to do is to get a logic naming of the single parts.
% Density: FG1, FG2
% Orientation: O0 O45 O90
% Seam: SO, SC
% Diamater: D15, D20
% Layheight: LL, LM, LH
% contournumbers: C1, C2
So a example of the part with all factor to be on 1 would be: FG1_O0_SO_D15_LL_C1
How can i like get a new table where matlab checks the entry of the columns in each row and depending on the entry get me out a new table with the naming?
Would be logic to get with "for" through all of the datas, but actually i can not figure out how to get me a string with a internal if function.
hope you guys can help me!
Thanks in advance!
  2 件のコメント
Jan
Jan 2018 年 11 月 16 日
I do not understand the question. "use the fullfact Method to create a table" is not clear. fullfact replies a matrix, doesn't it? Then how is the table created? "get a logic naming of the single parts" - what are "parts"?
Stephen23
Stephen23 2018 年 11 月 16 日
編集済み: Stephen23 2018 年 11 月 16 日
"So a example of the part with all factor to be on 1 would be: FG1_O0_SO_D15_LL_C1"
"hope you guys can help me!"
The best help you will get is advice to avoid what you are trying to do:
"How can i like get a new table where matlab checks the entry of the columns in each row and depending on the entry get me out a new table with the naming?"
Ugh. Forcing meta-data into variable names is one way that some beginners force themselves into writing pointlessly slow, complex, buggy code that is hard to debug. Read this to know why:

サインインしてコメントする。

採用された回答

Jan
Jan 2018 年 11 月 16 日
"FG1_O0_SO_D15_LL_C1" seems to be an extremely ugly name for a variable or name of a table column. Here you hide important information in the name in a very cryptic fashion. It sounds like you want to create these variables dynamically, which is a very bad idea - see TUTORIAL: Eval .
Prefer to store the data in a clear way. E.g. a struct with the fields 'Density', 'Orientation', ... is much better than a magically encrypted keyword like 'FG1_O0_SO_D15_LL_C1'.
I'm not sure what "get me out a new table with the naming" means, but this condensed name is not useful as header or a table also, because it is confusing for a human reader and unnecessarily compact for the computer.

その他の回答 (1 件)

Vincent Kelber
Vincent Kelber 2018 年 11 月 17 日
Thanks guys,
i figured out how to do it. Actually the naming was just a sample. i need this Funktion to read out the Matrix a couple more times. BBut it works now, so all good :)

カテゴリ

Help Center および File ExchangeIndustrial Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by