I could not obtain a sample ffrom the data by using the command uq_getSample

Dear UqLab Developper,
I have a data set and fit this data into a kernel distribution with bandwith 33.99. Then, I created 3 Input marginals. Based on this input, I would lile to derive a sample of 100x3. I always encountre with a message “Struct contents reference from a non-struct array object.” My code is as follows:
clc; close all;
M=[-3.33;
4.98;
-1.58;
-8.27;
-3.08;
-6.87;
0.52;
-11.73;
-12.77;
-19.54;
-26.24;
-37.34;
-33.00;
-31.55;
-37.73;
-31.39;
-32.28;
-60.74;
-65.97;
-51.64;
-63.22;
-77.46;
-90.83;
-87.73;
-86.60;
-91.82;
-90.51;
-95.59;
-96.75;
-97.32;
-128.93;
-129.07;
-121.10;
-132.82;
-138.80;
-156.70;
-170.02;
-165.36;
-163.55;
-155.61;
-161.28;
-179.89;
-181.40;
-172.29;
-166.57;
-188.02;
-185.69;
-200.59;
-200.53;
-211.83;
-225.78;
-236.18;
-239.08;
-247.59;
-221.89;
-221.09;
-220.17;
-223.12;
-218.55;
-225.65;
-247.85;
-260.16;
-253.97;
-252.54;
-233.69;
-229.71;
-250.95;
-262.51;
-241.89;
-273.59;
-288.41;
-296.27;
-293.64;
-281.16;
-272.03;
-275.13;
-270.51;
-270.14;
-240.92;
-255.54;
-253.20;
-286.28;
-280.68;
-266.52;
-277.24;
-277.02;
-280.86;
-260.45;
-250.50;
-285.82;
-273.25;
-242.03;
-262.33;
-268.73;
-233.60;
-241.18;
-198.38;
-200.39;
-142.94;
-80.35];
Input.Marginals(1).Name=‘D1’;
Input.Marginals(1).Type =‘KS’;
Input.Marginals(1).Parameters =M;
Input.Marginals(1).Options.Bandwith=33.99;
Input.Marginals(1).Options.Support=[-296.3 4.98];
Input.Marginals(2).Name=‘D2’;
Input.Marginals(2).Type =‘KS’;
Input.Marginals(2).Parameters = M;
Input.Marginals(2).Options.Bandwith=33.99;
Input.Marginals(2).Options.Support=[-296.3 4.98];
Input.Marginals(3).Name=‘D12’;
Input.Marginals(3).Type =‘KS’;
Input.Marginals(3).Parameters =M;
Input.Marginals(3).Options.Bandwith=33.99;
Input.Marginals(3).Options.Support=[-296.3 4.98];
Input.Copula.Type=(‘Independent’);
MyInput1 = uq_KernelMarginals(Input.Marginals);
a=uq_getSample(30);
ı deeply appreciate your help and valuable comments
Alper
Best regards

Dear @Murat_Alper_BASARAN

I think the error comes from the way you define your input. If you take a look at the input manual, you will see that uq_kernelMarginals does not take a structure as input, but the following:
myInput = uq_KernelMarginals(X, bounds, bandwidth):

I think you should get the samples you want by replacing your second last line to:

MyInput1 = uq_createInput(Input);

Let me know if this doesn’t give you the samples you want.

Best regards
Styfen

PS: You you have to fix the typo in ‘Bandwidth’ (missing ‘d’).

Dear Prof. Styfen Schaer
I appreciate your help. I will apply what you suggest and let you know.

Best Regards

Dear Prof. Styfen Schaer,
I resolved the issue that I sent it previously. However, I could not get the metamodel and its coefficients based on the code as follows: Do you have any suggestions regarding the code and its warning message. I appreciate your help and comments in advance
M=[-3.33 -3.33 -3.33;
4.98 4.98 4.98;
-1.58 -1.58 -1.58;
-8.27 -8.27 -8.27;
-3.08 -3.08 -3.08;
-6.87 -6.87 -6.87;
0.52 0.52 0.52;
-11.73 -11.73 -11.73;
-12.77 -12.77 -12.77;
-19.54 -19.54 -19.54;
-26.24 -26.24 -26.24;
-37.34 -37.34 -37.34;
-33.00 -33.00 -33.00;
-31.55 -31.55 -31.55;
-37.73 -37.73 -37.73;
-31.39 -31.39 -31.39;
-32.28 -32.28 -32.28;
-60.74 -60.74 -60.74;
-65.97 -65.97 -65.97;
-51.64 -51.64 -51.64;
-63.22 -63.22 -63.22;
-77.46 -77.46 -77.46;
-90.83 -90.83 -90.83;
-87.73 -87.73 -87.73;
-86.60 -86.60 -86.60;
-91.82 -91.82 -91.82;
-90.51 -90.51 -90.51;
-95.59 -95.59 -95.59;
-96.75 -96.75 -96.75;
-97.32 -97.32 -97.32;
-128.93 -128.93 -128.93;
-129.07 -129.07 -129.07;
-121.10 -121.10 -121.10;
-132.82 -132.82 -132.82;
-138.80 -138.80 -138.80;
-156.70 -156.70 -156.70;
-170.02 -170.02 -170.02;
-165.36 -165.36 -165.36;
-163.55 -163.55 -163.55;
-155.61 -155.61 -155.61;
-161.28 -161.28 -161.28;
-179.89 -179.89 -179.89;
-181.40 -181.40 -181.40;
-172.29 -172.29 -172.29;
-166.57 -166.57 -166.57;
-188.02 -188.02 -188.02;
-185.69 -185.69 -185.69;
-200.59 -200.59 -200.59;
-200.53 -200.53 -200.53;
-211.83 -211.83 -211.83;
-225.78 -225.78 -225.78;
-236.18 -236.18 -236.18;
-239.08 -239.08 -239.08;
-247.59 -247.59 -247.59;
-221.89 -221.89 -221.89;
-221.09 -221.09 -221.09;
-220.17 -220.17 -220.17;
-223.12 -223.12 -223.12;
-218.55 -218.55 -218.55;
-225.65 -225.65 -225.65;
-247.85 -247.85 -247.85;
-260.16 -260.16 -260.16;
-253.97 -253.97 -253.97;
-252.54 -252.54 -252.54;
-233.69 -233.69 -233.69;
-229.71 -229.71 -229.71;
-250.95 -250.95 -250.95;
-262.51 -262.51 -262.51;
-241.89 -241.89 -241.89;
-273.59 -273.59 -273.59;
-288.41 -288.41 -288.41;
-296.27 -296.27 -296.27;
-293.64 -293.64 -293.64;
-281.16 -281.16 -281.16;
-272.03 -272.03 -272.03;
-275.13 -275.13 -275.13;
-270.51 -270.51 -270.51;
-270.14 -270.14 -270.14;
-240.92 -240.92 -240.92;
-255.54 -255.54 -255.54;
-253.20 -253.20 -253.20;
-286.28 -286.28 -286.28;
-280.68 -280.68 -280.68;
-266.52 -266.52 -266.52;
-277.24 -277.24 -277.24;
-277.02 -277.02 -277.02;
-280.86 -280.86 -280.86;
-260.45 -260.45 -260.45;
-250.50 -250.50 -250.50;
-285.82 -285.82 -285.83;
-273.25 -273.25 -273.25;
-242.03 -242.03 -242.03;
-262.33 -262.33 -262.33;
-268.73 -268.73 -268.73;
-233.60 -233.60 -233.60;
-241.18 -241.18 -241.18;
-198.38 -198.38 -198.38;
-200.39 -200.39 -200.39;
-142.94 -142.94 -142.94;
-80.35 -80.35 -80.35];
B=[13.82
14.26
31.49
39.27
45.03
52.89
57.43
73.03
77.34
94.57
103.21
124.17
127.38
130.49
142.76
144.29
149.86
180.38
189.97
192.86
206.05
221.38
243.15
248.91
254.38
265.01
266.80
272.25
280.81
295.49
328.25
334.46
335.51
352.17
367.20
386.49
401.80
405.99
408.74
413.88
423.44
448.27
450.59
451.30
466.29
488.15
493.58
511.45
521.18
538.28
562.36
576.76
589.41
598.70
599.40
604.50
604.66
618.89
622.95
645.76
669.84
682.40
685.30
697.78
699.42
700.03
729.51
743.59
752.29
787.43
807.21
817.78
819.84
832.84
836.90
840.85
846.19
855.90
856.79
876.56
880.52
915.15
925.42
936.99
948.37
952.30
960.33
965.60
979.25
1016.00
1021.00
1029.00
1055.00
1066.00
1083.00
1094.00
1112.00
1116.00
1122.00
1129.00];
iOpts.Inference.Data=M;
iOpts.Copula.Type=‘Independent’;
A=uq_createInput(iOpts);
MetaOpts(1).ExpDesign.Sampling=‘KS, [-296 4.98]’;
MetaOpts(2).ExpDesign.Sampling=‘KS, [-296 4.98]’;
MetaOpts(3).ExpDesign.Sampling=‘KS, [-296 4.98]’;
sample=uq_getSample(100);
sample_eva=uq_getSample(500);
MetaOpts.ExpDesign.X=sample;
MetaOpts.ExpDesign.Y=B;
MetaOpts.Degree=1:10;
MetaOpts.Type=‘Metamodel’;
MetaOpts.MetaType=‘PCE’;
MetaOpts.Method=‘LARS’;
FinalModel=uq_createModel(MetaOpts);
the warning message is as follows:
Scalar structure required for this assignment.

Error in sampling (line 209)
MetaOpts.ExpDesign.X=sample;