# Replace values with specified values

4 Ansichten (letzte 30 Tage)
tompaine am 20 Mai 2015
Beantwortet: Faysal Andary am 18 Jan. 2023
I have a full factorial design array and certain levels
a = [6,8]
b = [10,13,5]
dF = fullfact([2 3])
=
1 1
2 1
1 2
2 2
1 3
2 3
I would like to replace the values [1,2] of the first column with a and in the second [1,2,3] with b so that
dF =
6 10
8 13
6 5
8 10
6 13
8 5
Is there an easy way to do it? I'll need it for a 388800x10 full factorial with up to 12 different levels for each column, so I cannot replace all values one by one.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Thomas Koelen am 20 Mai 2015
I answered the (somewhat) same question yesterday, this should solve your issue:
If you run in to any problems feel free to ask them here.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
tompaine am 20 Mai 2015
This makes sense if you only have three levels. I have a 388800x10 full factorial with up to 12 different levels for each column. Is there a shorter way?

Melden Sie sich an, um zu kommentieren.

Faysal Andary am 18 Jan. 2023
a = [6,8];
b = [10,13,5];
ffPlan = fullfact([2, 3]);
parPlan = zeros(size(ffPlan));
parPlan(:,1) = a(ffPlan(:,1));
parPlan(:,2) = b(ffPlan(:,2));
disp(parPlan)
6 10 8 10 6 13 8 13 6 5 8 5
If you have more than a couple variables, you can use a for loop for the columns
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by