Asking for help with variables
1) I am developing a code and I have stored a column from a database (numerical values) inside a variable. When using the ‘ones’ function and utilizing the variable where I have stored the column, the code does not work. However, when I program the same function and call the column of values directly, it allows me to run the code. Is there any way to use the name of the variable that I created?
n_inter = length(data_inter.RSN); % Utilizado para regresion
n_intra = length(data_intra.RSN); % Utilizado para regresion
x_axis = PGA1100_inter; % variable seleccionada para eje x
X_inter = [ones(n_inter,1) data_inter.PGA1100]; (allows me)
X_intra = [ones(n_intra,1) x_axis]; (does not allow)
2) Also, I would like to know if it is possible to store the following code inside a table, meaning that the workspace looks much cleaner and all the generated variables are stored inside a table.
% Interplaca
[b_inter_PGA] = regress(data_inter.res_PGA, X_inter);
[b_inter_PGV] = regress(data_inter.res_PGV, X_inter);
[b_inter_002] = regress(data_inter.res_002, X_inter);
[b_inter_015] = regress(data_inter.res_015, X_inter);
[b_inter_02] = regress(data_inter.res_02, X_inter);
[b_inter_03] = regress(data_inter.res_03, X_inter);
[b_inter_1] = regress(data_inter.res_1, X_inter);
[b_inter_3] = regress(data_inter.res_3, X_inter);1) I am developing a code and I have stored a column from a database (numerical values) inside a variable. When using the ‘ones’ function and utilizing the variable where I have stored the column, the code does not work. However, when I program the same function and call the column of values directly, it allows me to run the code. Is there any way to use the name of the variable that I created?
n_inter = length(data_inter.RSN); % Utilizado para regresion
n_intra = length(data_intra.RSN); % Utilizado para regresion
x_axis = PGA1100_inter; % variable seleccionada para eje x
X_inter = [ones(n_inter,1) data_inter.PGA1100]; (allows me)
X_intra = [ones(n_intra,1) x_axis]; (does not allow)
2) Also, I would like to know if it is possible to store the following code inside a table, meaning that the workspace looks much cleaner and all the generated variables are stored inside a table.
% Interplaca
[b_inter_PGA] = regress(data_inter.res_PGA, X_inter);
[b_inter_PGV] = regress(data_inter.res_PGV, X_inter);
[b_inter_002] = regress(data_inter.res_002, X_inter);
[b_inter_015] = regress(data_inter.res_015, X_inter);
[b_inter_02] = regress(data_inter.res_02, X_inter);
[b_inter_03] = regress(data_inter.res_03, X_inter);
[b_inter_1] = regress(data_inter.res_1, X_inter);
[b_inter_3] = regress(data_inter.res_3, X_inter); 1) I am developing a code and I have stored a column from a database (numerical values) inside a variable. When using the ‘ones’ function and utilizing the variable where I have stored the column, the code does not work. However, when I program the same function and call the column of values directly, it allows me to run the code. Is there any way to use the name of the variable that I created?
n_inter = length(data_inter.RSN); % Utilizado para regresion
n_intra = length(data_intra.RSN); % Utilizado para regresion
x_axis = PGA1100_inter; % variable seleccionada para eje x
X_inter = [ones(n_inter,1) data_inter.PGA1100]; (allows me)
X_intra = [ones(n_intra,1) x_axis]; (does not allow)
2) Also, I would like to know if it is possible to store the following code inside a table, meaning that the workspace looks much cleaner and all the generated variables are stored inside a table.
% Interplaca
[b_inter_PGA] = regress(data_inter.res_PGA, X_inter);
[b_inter_PGV] = regress(data_inter.res_PGV, X_inter);
[b_inter_002] = regress(data_inter.res_002, X_inter);
[b_inter_015] = regress(data_inter.res_015, X_inter);
[b_inter_02] = regress(data_inter.res_02, X_inter);
[b_inter_03] = regress(data_inter.res_03, X_inter);
[b_inter_1] = regress(data_inter.res_1, X_inter);
[b_inter_3] = regress(data_inter.res_3, X_inter); variables, ones, database MATLAB Answers — New Questions