Category: Matlab
Category Archives: Matlab
Why do I receive License Manager Error -9?
I installed the matlab R2024a trial on linux and followed the activation instructions at https://ww2.mathworks.cn/matlabcentral/answers/99457-how-do-i-activate-matlab-or-other- mathworks-products but still getting license error, I need help. ThanksI installed the matlab R2024a trial on linux and followed the activation instructions at https://ww2.mathworks.cn/matlabcentral/answers/99457-how-do-i-activate-matlab-or-other- mathworks-products but still getting license error, I need help. Thanks I installed the matlab R2024a trial on linux and followed the activation instructions at https://ww2.mathworks.cn/matlabcentral/answers/99457-how-do-i-activate-matlab-or-other- mathworks-products but still getting license error, I need help. Thanks installation MATLAB Answers — New Questions
why can’t I use uitable to display a table on a figure?
I want to show the parameters of a matlab system object within a figure.
I use get to return the parameters as a struct
I use struct2table to convert it to a table
I use uitable to display the table and get
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
See the documentation for correct uitable usage:
help uitable and doc uitable
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
> In uitable_deprecated
So now I understand that it’s deprecated. I’m directed to the help documentation but the documentation does not to help
So I use cell2mat to get an array of values
I write a few lines of matlab to get an array of strings
I use table to create a table from the two arrays
I use uitable on this table and I get
Error using uitable
Functionality not supported with figures created with the figure function.
Error in uitable (line 54)
thandle = builtin(‘uitable’, varargin{:});
I give upI want to show the parameters of a matlab system object within a figure.
I use get to return the parameters as a struct
I use struct2table to convert it to a table
I use uitable to display the table and get
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
See the documentation for correct uitable usage:
help uitable and doc uitable
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
> In uitable_deprecated
So now I understand that it’s deprecated. I’m directed to the help documentation but the documentation does not to help
So I use cell2mat to get an array of values
I write a few lines of matlab to get an array of strings
I use table to create a table from the two arrays
I use uitable on this table and I get
Error using uitable
Functionality not supported with figures created with the figure function.
Error in uitable (line 54)
thandle = builtin(‘uitable’, varargin{:});
I give up I want to show the parameters of a matlab system object within a figure.
I use get to return the parameters as a struct
I use struct2table to convert it to a table
I use uitable to display the table and get
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
See the documentation for correct uitable usage:
help uitable and doc uitable
Warning: This implementation of uitable is no longer supported and will be removed in a future release.
> In uitable_deprecated
So now I understand that it’s deprecated. I’m directed to the help documentation but the documentation does not to help
So I use cell2mat to get an array of values
I write a few lines of matlab to get an array of strings
I use table to create a table from the two arrays
I use uitable on this table and I get
Error using uitable
Functionality not supported with figures created with the figure function.
Error in uitable (line 54)
thandle = builtin(‘uitable’, varargin{:});
I give up uitable MATLAB Answers — New Questions
Incorrect result from camera calibrator app
I used the camera calibrator app to calibrate lens distortion and I specified correct checkerboard size of 8mm. The calibration goes fine and i’m able to undistort images and points. However, the plot from showextrinsics() shows camera at 8mm distance from object but in reality it is 140mm. Why is this wrong?
My setup has a camera looking downwards and pattern is placed at the same working distance in all 30+ images where the lens is focused.
Calibration settings: All default settings – Standard lens, 2 coeffs, no tangential distortion, no skew, etc.I used the camera calibrator app to calibrate lens distortion and I specified correct checkerboard size of 8mm. The calibration goes fine and i’m able to undistort images and points. However, the plot from showextrinsics() shows camera at 8mm distance from object but in reality it is 140mm. Why is this wrong?
My setup has a camera looking downwards and pattern is placed at the same working distance in all 30+ images where the lens is focused.
Calibration settings: All default settings – Standard lens, 2 coeffs, no tangential distortion, no skew, etc. I used the camera calibrator app to calibrate lens distortion and I specified correct checkerboard size of 8mm. The calibration goes fine and i’m able to undistort images and points. However, the plot from showextrinsics() shows camera at 8mm distance from object but in reality it is 140mm. Why is this wrong?
My setup has a camera looking downwards and pattern is placed at the same working distance in all 30+ images where the lens is focused.
Calibration settings: All default settings – Standard lens, 2 coeffs, no tangential distortion, no skew, etc. camera calibrator app MATLAB Answers — New Questions
自适应加权 – help with adaptive weighting
自适应加权数据融合算法应用simulink如何仿真
How to simulate the adaptive weighted data fusion algorithm using simulink?自适应加权数据融合算法应用simulink如何仿真
How to simulate the adaptive weighted data fusion algorithm using simulink? 自适应加权数据融合算法应用simulink如何仿真
How to simulate the adaptive weighted data fusion algorithm using simulink? simulink MATLAB Answers — New Questions
Unable to load Online Courses
I have got part way through the Self-Paced Online Courses but now it hangs trying to load. I’m runnning a MacBook Pro M3 ProI have got part way through the Self-Paced Online Courses but now it hangs trying to load. I’m runnning a MacBook Pro M3 Pro I have got part way through the Self-Paced Online Courses but now it hangs trying to load. I’m runnning a MacBook Pro M3 Pro self-paced online courses MATLAB Answers — New Questions
the geometry that i imported from solidwork to simscape isnt the same what sould i do to solve it
i have my rov model imported from solidwork to simscape everything is alreaight exept when i click into the file solid of my propelers the geometry isnt the same as my propelers in solidwork idk where is the probleme and how to fix it so that when i press run to simulate i see my rov whith his propelers not whith this red blocsi have my rov model imported from solidwork to simscape everything is alreaight exept when i click into the file solid of my propelers the geometry isnt the same as my propelers in solidwork idk where is the probleme and how to fix it so that when i press run to simulate i see my rov whith his propelers not whith this red blocs i have my rov model imported from solidwork to simscape everything is alreaight exept when i click into the file solid of my propelers the geometry isnt the same as my propelers in solidwork idk where is the probleme and how to fix it so that when i press run to simulate i see my rov whith his propelers not whith this red blocs simscape, rov, geometry MATLAB Answers — New Questions
How can I generate in Simulink a block that has time delay in only one coefficient on the numerator of the transfer function?
Let’s say for example that I have a transfer function: .
If the coefficients a1 = a2 = 0, then it is easy to transform this into Simulink (I will not post this since it is easy and hence a waste of time). My initial thought was that there is a certain block that multiplies only a certain coefficient with whatever block I may want. However, I did not find any of it. If there is, however, and I am just not aware of it, I would really appreciate it if you tell me.
Trying to generate this transfer function in Matlab is pretty easy, (let’s say all the an = 1 and θ = 2), as seen in the end.
Trying to implement the same idea to sum two separate transfer functions in Simulink however is not as easy. Because the blocks of the transfer functions G1 and G2 require a certain input. So I will either sum their outputs while having the same input, or sum the output of one to the input of the other. In both cases, I cannot reach the goal that I want. To have a whole transfer function G given one input and take its output. The reason why this works in Matlab is because I can add two transfer functions before giving them any input, something that it is not possible in Simulink.
Below I have a picture of a Simulink simulation, which is off course false as stated above.
I would really apriciate your help. Thank you in advance.
G1 = tf([1 1 0],[1 1 1 1 1])
G2 = tf([1],[1 1 1 1 1],’InputDelay’,2)
G = G1 + G2Let’s say for example that I have a transfer function: .
If the coefficients a1 = a2 = 0, then it is easy to transform this into Simulink (I will not post this since it is easy and hence a waste of time). My initial thought was that there is a certain block that multiplies only a certain coefficient with whatever block I may want. However, I did not find any of it. If there is, however, and I am just not aware of it, I would really appreciate it if you tell me.
Trying to generate this transfer function in Matlab is pretty easy, (let’s say all the an = 1 and θ = 2), as seen in the end.
Trying to implement the same idea to sum two separate transfer functions in Simulink however is not as easy. Because the blocks of the transfer functions G1 and G2 require a certain input. So I will either sum their outputs while having the same input, or sum the output of one to the input of the other. In both cases, I cannot reach the goal that I want. To have a whole transfer function G given one input and take its output. The reason why this works in Matlab is because I can add two transfer functions before giving them any input, something that it is not possible in Simulink.
Below I have a picture of a Simulink simulation, which is off course false as stated above.
I would really apriciate your help. Thank you in advance.
G1 = tf([1 1 0],[1 1 1 1 1])
G2 = tf([1],[1 1 1 1 1],’InputDelay’,2)
G = G1 + G2 Let’s say for example that I have a transfer function: .
If the coefficients a1 = a2 = 0, then it is easy to transform this into Simulink (I will not post this since it is easy and hence a waste of time). My initial thought was that there is a certain block that multiplies only a certain coefficient with whatever block I may want. However, I did not find any of it. If there is, however, and I am just not aware of it, I would really appreciate it if you tell me.
Trying to generate this transfer function in Matlab is pretty easy, (let’s say all the an = 1 and θ = 2), as seen in the end.
Trying to implement the same idea to sum two separate transfer functions in Simulink however is not as easy. Because the blocks of the transfer functions G1 and G2 require a certain input. So I will either sum their outputs while having the same input, or sum the output of one to the input of the other. In both cases, I cannot reach the goal that I want. To have a whole transfer function G given one input and take its output. The reason why this works in Matlab is because I can add two transfer functions before giving them any input, something that it is not possible in Simulink.
Below I have a picture of a Simulink simulation, which is off course false as stated above.
I would really apriciate your help. Thank you in advance.
G1 = tf([1 1 0],[1 1 1 1 1])
G2 = tf([1],[1 1 1 1 1],’InputDelay’,2)
G = G1 + G2 simulink, transfer function, transport delay MATLAB Answers — New Questions
model of the ADRC order for the GSAP.
Hello I need the model of the ADRC order for the GSAP.
the plans of my PFE subject are:
-Model of the Turbine
-GSAP + NPC multilevel inverter
-commende ADRC (Active distribution rejection control)Hello I need the model of the ADRC order for the GSAP.
the plans of my PFE subject are:
-Model of the Turbine
-GSAP + NPC multilevel inverter
-commende ADRC (Active distribution rejection control) Hello I need the model of the ADRC order for the GSAP.
the plans of my PFE subject are:
-Model of the Turbine
-GSAP + NPC multilevel inverter
-commende ADRC (Active distribution rejection control) adrc, pmsg MATLAB Answers — New Questions
Sync time of the loop and the time step of the simulation
Dear all,
I am using a For loop in my simulink model. Let’s say simple factorial function.
It receives a number(for instance 4) and returns the factorial of the input(24).
1) The main question is
The whole loops (i=1,…4) occurs in one single time stamp of the simulation. Also at the MATLAB document I found a note that
"Simulation time does not advance during iterative executions of a While/(For) Iterator Subsystem block. Nevertheless, blocks in the subsystem treat each iteration as a time step. .."
This is not what I want.
I want in a single step of my simulation i turns to 1, then in the next step it becomes 2, and ,….
How I can do that?
(The type of the solver selection is Fixed-Step but the simulation time is 10 seconds, but we do not want to change the simulation time starting and ending)
2) Does the functions that we wrote as MATLAb function that has a loop inside the code, treats similarly?
I mean the whole code is run once in one single step.
If yes, How I can change the code so each iteration performs in each single step of the simulation.
3) When I do not select "states when starting" to "reset", it returns zero as an output(I already set initial value of the delay to 1). I do not undrestand why?
Thanks…Dear all,
I am using a For loop in my simulink model. Let’s say simple factorial function.
It receives a number(for instance 4) and returns the factorial of the input(24).
1) The main question is
The whole loops (i=1,…4) occurs in one single time stamp of the simulation. Also at the MATLAB document I found a note that
"Simulation time does not advance during iterative executions of a While/(For) Iterator Subsystem block. Nevertheless, blocks in the subsystem treat each iteration as a time step. .."
This is not what I want.
I want in a single step of my simulation i turns to 1, then in the next step it becomes 2, and ,….
How I can do that?
(The type of the solver selection is Fixed-Step but the simulation time is 10 seconds, but we do not want to change the simulation time starting and ending)
2) Does the functions that we wrote as MATLAb function that has a loop inside the code, treats similarly?
I mean the whole code is run once in one single step.
If yes, How I can change the code so each iteration performs in each single step of the simulation.
3) When I do not select "states when starting" to "reset", it returns zero as an output(I already set initial value of the delay to 1). I do not undrestand why?
Thanks… Dear all,
I am using a For loop in my simulink model. Let’s say simple factorial function.
It receives a number(for instance 4) and returns the factorial of the input(24).
1) The main question is
The whole loops (i=1,…4) occurs in one single time stamp of the simulation. Also at the MATLAB document I found a note that
"Simulation time does not advance during iterative executions of a While/(For) Iterator Subsystem block. Nevertheless, blocks in the subsystem treat each iteration as a time step. .."
This is not what I want.
I want in a single step of my simulation i turns to 1, then in the next step it becomes 2, and ,….
How I can do that?
(The type of the solver selection is Fixed-Step but the simulation time is 10 seconds, but we do not want to change the simulation time starting and ending)
2) Does the functions that we wrote as MATLAb function that has a loop inside the code, treats similarly?
I mean the whole code is run once in one single step.
If yes, How I can change the code so each iteration performs in each single step of the simulation.
3) When I do not select "states when starting" to "reset", it returns zero as an output(I already set initial value of the delay to 1). I do not undrestand why?
Thanks… simulink, loop, for loop, simulation, iteration MATLAB Answers — New Questions
How can I get debug information for Polyspace Access running in Kubernetes?
When experiencing an issue with Polyspace Access installed in a Kubernetes cluster, how do I generate logs or reports that I can send to MathWorks Support to help diagnose the issue?When experiencing an issue with Polyspace Access installed in a Kubernetes cluster, how do I generate logs or reports that I can send to MathWorks Support to help diagnose the issue? When experiencing an issue with Polyspace Access installed in a Kubernetes cluster, how do I generate logs or reports that I can send to MathWorks Support to help diagnose the issue? MATLAB Answers — New Questions
How to plot contour ?
clc
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01 = 1.578; % Refractive index of PS
n02 = 1.484; % Refractive index of PMMA
n=25;
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c);
DBB=dB * nB * (w/c);
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
end
plot(frequency,transmission)
this code is transmission spectra
I need a contour plot of this by varying the n01 and n02 with respect to Q factor
I did a program but is not working
can anyone help me
clc
clear
close all
tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
P = 0; %%% Hydrostatic pressure in MPa
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
%%% frequency Range
% f = 61.25; %% frequency in THz
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01_ = linspace(1.3,4,25); % Refractive index of PS
n02_ = linspace(1.3,4,25); % Refractive index of PMMA
n=25;
% Q factor array
Q_factor_ = zeros(length(n01_), length(n02_));
for ii = 1:length(n01_)
n01 = n01_(ii);
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters (varying with respect to n01)
for jj = 1:length(n02_)
n02 = n02_(jj);
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters (varying with respect to n02)
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c); %%% (varying with respect to n01)
DBB=dB * nB * (w/c); %%% (varying with respect to n02)
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
desired_freq = 60;
peak_idx = find((frequency) == (desired_freq));
peak_val = transmission(peak_idx);
half_max = peak_val / 2;
peak_left_edge = find(transmission(1:peak_idx) < half_max, 1, ‘last’);
peak_right_edge = find(transmission(peak_idx:end) < half_max, 1, ‘first’) + peak_idx – 1;
fwhm = frequency(peak_right_edge) – frequency(peak_left_edge); %%% full width at half maximum
% Calculate Q factor
Q = desired_freq ./ fwhm;
% Store Q factor in array
Q_factor_(:,:,i) = Q;
end
end
end
contourf(n01_,n02_,Q_factor_)clc
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01 = 1.578; % Refractive index of PS
n02 = 1.484; % Refractive index of PMMA
n=25;
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c);
DBB=dB * nB * (w/c);
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
end
plot(frequency,transmission)
this code is transmission spectra
I need a contour plot of this by varying the n01 and n02 with respect to Q factor
I did a program but is not working
can anyone help me
clc
clear
close all
tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
P = 0; %%% Hydrostatic pressure in MPa
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
%%% frequency Range
% f = 61.25; %% frequency in THz
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01_ = linspace(1.3,4,25); % Refractive index of PS
n02_ = linspace(1.3,4,25); % Refractive index of PMMA
n=25;
% Q factor array
Q_factor_ = zeros(length(n01_), length(n02_));
for ii = 1:length(n01_)
n01 = n01_(ii);
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters (varying with respect to n01)
for jj = 1:length(n02_)
n02 = n02_(jj);
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters (varying with respect to n02)
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c); %%% (varying with respect to n01)
DBB=dB * nB * (w/c); %%% (varying with respect to n02)
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
desired_freq = 60;
peak_idx = find((frequency) == (desired_freq));
peak_val = transmission(peak_idx);
half_max = peak_val / 2;
peak_left_edge = find(transmission(1:peak_idx) < half_max, 1, ‘last’);
peak_right_edge = find(transmission(peak_idx:end) < half_max, 1, ‘first’) + peak_idx – 1;
fwhm = frequency(peak_right_edge) – frequency(peak_left_edge); %%% full width at half maximum
% Calculate Q factor
Q = desired_freq ./ fwhm;
% Store Q factor in array
Q_factor_(:,:,i) = Q;
end
end
end
contourf(n01_,n02_,Q_factor_) clc
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01 = 1.578; % Refractive index of PS
n02 = 1.484; % Refractive index of PMMA
n=25;
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c);
DBB=dB * nB * (w/c);
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
end
plot(frequency,transmission)
this code is transmission spectra
I need a contour plot of this by varying the n01 and n02 with respect to Q factor
I did a program but is not working
can anyone help me
clc
clear
close all
tic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define material properties and simulation parameters
P = 0; %%% Hydrostatic pressure in MPa
n0 = 1; % Refractive index of air
ns = 1.46; % Refractive index of subtrate
% Parameters
lambda0=5e-6; % Wavelength of light in micrometers
%%% frequency Range
% f = 61.25; %% frequency in THz
frequency = linspace(58,67,1000);
c=3e8;
transmission=zeros(1,1000);
n01_ = linspace(1.3,4,25); % Refractive index of PS
n02_ = linspace(1.3,4,25); % Refractive index of PMMA
n=25;
% Q factor array
Q_factor_ = zeros(length(n01_), length(n02_));
for ii = 1:length(n01_)
n01 = n01_(ii);
nA = n01;
dA = lambda0/(4*nA); %% Thickness of First Layer in meters (varying with respect to n01)
for jj = 1:length(n02_)
n02 = n02_(jj);
nB = n02;
dB = lambda0/(4*nB); %% Thickness of Second Layer in meters (varying with respect to n02)
for i = 1:length(frequency)
f = frequency(i);
w=2*pi*f*1e12; %%% Angular frequency by frequency
DAA=dA * nA * (w/c); %%% (varying with respect to n01)
DBB=dB * nB * (w/c); %%% (varying with respect to n02)
%%% Transfer Matrix elements of first layer
ma11=cos(DAA); ma12=-1i*sin(DAA)/nA; ma21=-1i*nA*sin(DAA); ma22=cos(DAA);
MA=[ma11 ma12; ma21 ma22];
%%% Transfer MAtrix elements of Second layer
lb11=cos(DBB); lb12=-1i*sin(DBB)/nB; lb21=-1i*nB*sin(DBB); lb22=cos(DBB);
MB=[lb11 lb12; lb21 lb22];
M_total_P = (MB*MA)^n*(MA*MB)^n;
T1 = (2*ns/(ns*M_total_P(1,1)+ns*n0*M_total_P(1,2)+M_total_P(2,1)+n0*M_total_P(2,2)));
T=(n0 / ns) * abs(T1)^2;
transmission(i) = T;
desired_freq = 60;
peak_idx = find((frequency) == (desired_freq));
peak_val = transmission(peak_idx);
half_max = peak_val / 2;
peak_left_edge = find(transmission(1:peak_idx) < half_max, 1, ‘last’);
peak_right_edge = find(transmission(peak_idx:end) < half_max, 1, ‘first’) + peak_idx – 1;
fwhm = frequency(peak_right_edge) – frequency(peak_left_edge); %%% full width at half maximum
% Calculate Q factor
Q = desired_freq ./ fwhm;
% Store Q factor in array
Q_factor_(:,:,i) = Q;
end
end
end
contourf(n01_,n02_,Q_factor_) contour, plot, for loop MATLAB Answers — New Questions
In app designer, I have a random number generated that is assigned to a variable. If the number is 1, I want the user to be able to choose the value of this variable: 1 or 11
if p1 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% I need the code to pause here in app designer, ask the
% user for input then assign that input to p1
p1 = app.AceValueEditField.Value
elseif p2 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% Same as above here
p2 = app.AceValueEditField.Value
else
p1 = p1;
p2 = p2;
endif p1 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% I need the code to pause here in app designer, ask the
% user for input then assign that input to p1
p1 = app.AceValueEditField.Value
elseif p2 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% Same as above here
p2 = app.AceValueEditField.Value
else
p1 = p1;
p2 = p2;
end if p1 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% I need the code to pause here in app designer, ask the
% user for input then assign that input to p1
p1 = app.AceValueEditField.Value
elseif p2 == 1
app.EditField.Value = ‘You have drawn an ace! Please enter a value of 1 or 11 below.’
% Same as above here
p2 = app.AceValueEditField.Value
else
p1 = p1;
p2 = p2;
end appdesigner MATLAB Answers — New Questions
How to stop double printing text using sprintf ?
Hi guys, im trying to write a file which contains text that i already defined in Matlab.
I have 2 problems here. First is my numbering inside the file is not match with numbring of my file’s name. You can see the picture below:
Here is my code :
clear;
clc;
H = 5;
L = 15;
Ns = 2;
Nb = 1;
PortalHeight = H;
Bayspan = L;
NumberStory = Ns;
NumberBay = Nb;
% Variable1
h = [0.8,1.00,1.20,1.40,1.6,1.80];
% Variable2
Lss = [2.00,2.40,2.80,3.20,3.60,4.00];
% Variable3
Nss = [2,3,4];
% Definition
Var1HeightofTrussBeam = h;
Var2LengthSpecialSegment = Lss;
Var3NumberSpecialSegment = Nss;
% % Xbase = zeros(1,length(Totalvariant));
% % Zbase = zeros(1,length(Totalvariant));
% % Xcol = zeros(1,length(Totalvariant));
% % Zcol = zeros(1,length(Totalvariant));
% % Xos = zeros(1,length(Totalvariant));
% % Zos = zeros(1,length(Totalvariant));
% % Xss = zeros(1,length(Totalvariant));
% % Zss = zeros(1,length(Totalvariant));
% % X = zeros(1,length(Totalvariant));
% % Z = zeros(1,length(Totalvariant));
% % jointbase = zeros(1,length(Totalvariant));
% % jointcolumn = zeros(1,length(Totalvariant));
% % jointordinarysegment = zeros(1,length(Totalvariant));
% % jointtopordinarysegment = zeros(1,length(Totalvariant));
% % jointbottomordinarysegment = zeros(1,length(Totalvariant));
% % jointspecialsegment = zeros(1,length(Totalvariant));
% % jointtopspecialsegment = zeros(1,length(Totalvariant));
% % jointbottomspecialsegment = zeros(1,length(Totalvariant));
ijk = 0;
for i = 1:numel(h)
for j = 1:numel(Lss)
for k = 1:numel(Nss)
ijk = ijk+1;
Variantmodel{ijk,:} = table(ijk,h(i),Lss(j),Nss(k),’VariableNames’,{‘VariantID’,’Height’,’Length’,’Number’});
%% Cooridinate Point Base(base)
Xbase{ijk,:} = L*(0:NumberBay);
Zbase{ijk,:} = repelem(0,1,length(Xbase{ijk,:}));
%% Column(col)
Xcolumn = L*(0:NumberBay);
Zcolumn = repelem(H*(1:NumberStory),1,length(Xcolumn));
Xbotbeam = L*(0:NumberBay);
Zbotbeam = repelem((H*(1:NumberStory)-h(i)),1,length(Xbotbeam));
idx = unique(Zbotbeam(:).’);
Zbottombeam{ijk,:} = idx;
% replicate [X] to be the same size as [Z] for plotting:
Xcol{ijk,:} = repmat([Xcolumn,Xbotbeam],1,NumberStory);
Zcol{ijk,:} = [Zcolumn,Zbotbeam];
%% Cooridinate Point Ordinary Segment (os)
% calculate span length of ordinary segment
Los = (L-Lss(j))/2;
Nos = Los/h(i);
Nos = round(Nos);
los = Los/Nos;
totalspan{ijk,:} = los*Nos*2+Lss(j);
if totalspan{ijk,:} == 15.000
checkspan{ijk,:} = "correct span";
else
checkspan{ijk,:} = "span must be 15m";
end
% top and bottom joint of ordinary segment(os)
XTopOrdinarySegment = reshape([los*(1:Nos),(L/2+Lss(j)/2)+los*(0:Nos-1)].’+L*(0:(NumberBay-1)),1,[]);
XBottomOrdinarySegment = XTopOrdinarySegment;
ZTopOrdinarySegment = repelem(H*(1:NumberStory),1,2*Nos*NumberBay);
ZBottomOrdinarySegment = repelem(H*(1:NumberStory)-h(i),1,2*Nos*NumberBay);
% replicate [X] to be the same size as [Z] for plotting:
Xos{ijk,:} = repmat([XTopOrdinarySegment,XBottomOrdinarySegment],1,NumberStory);
Zos{ijk,:} = [ZTopOrdinarySegment,ZBottomOrdinarySegment];
%% Cooridinate Point Special Segment (ss)
% calculate span length of special segment
lss = Lss(j)/Nss(k);
% top and bottom joint of special segment(ss)
XTopSpecialSegment = reshape((lss*(0:Nss(k))+L/2-Lss(j)/2).’+L*(0:(NumberBay-1)),1,[]);
XBottomSpecialSegment = XTopSpecialSegment;
ZTopSpecialSegment = repelem(H*(1:NumberStory),1,length(XTopSpecialSegment));
ZBottomSpecialSegment = repelem(H*(1:NumberStory)-h(i),1,length(XBottomSpecialSegment));
% replicate [X] to be the same size as [Z] for plotting:
Xss{ijk,:} = repmat([XTopSpecialSegment,XBottomSpecialSegment],1,NumberStory);
Zss{ijk,:} = [ZTopSpecialSegment,ZBottomSpecialSegment];
%% Plot Cooridinate Point (X,Z)
X{ijk,:} = [Xbase{ijk,:},Xcol{ijk,:},Xos{ijk,:},Xss{ijk,:}];
Z{ijk,:} = [Zbase{ijk,:},Zcol{ijk,:},Zos{ijk,:},Zss{ijk,:}];
scatter(X{ijk,:},Z{ijk,:},’filled’),grid on
%check angle
tangent = (Lss(j)/Nss(k))/h(i);
anglespecialsegment(ijk) = atand(tangent);
%% Name the Joint
jointbase{ijk} = table((1:numel(Xbase{ijk,:}))’,Xbase{ijk,:}’,Zbase{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointcolumn{ijk} = table((max(jointbase{ijk}.ID)+1:numel(Xcol{ijk,:})+max(jointbase{ijk}.ID))’,Xcol{ijk,:}’,Zcol{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointordinarysegment{ijk} = table((max(jointcolumn{ijk}.ID)+1:numel(Xos{ijk,:})+max(jointcolumn{ijk}.ID))’,Xos{ijk,:}’,Zos{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zcolumn),:);
jointbottomordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zbotbeam),:);
jointspecialsegment{ijk} = table((max(jointbottomordinarysegment{ijk}.ID)+1:numel(Xss{ijk,:})+max(jointbottomordinarysegment{ijk}.ID))’,Xss{ijk,:}’,Zss{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zcolumn),:);
jointbottomspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zbotbeam),:);
end
end
end
% Verify Variants Which Passed the Angle Requirement
tablecheck = table((1:numel(anglespecialsegment))’,totalspan,anglespecialsegment’,’VariableNames’,{‘VariantID’,’Total Span’,’Angle’});
VariantIDPassed = tablecheck.VariantID(tablecheck.Angle>=30 & tablecheck.Angle<=60);
jointbase = table((1:numel(jointbase))’,jointbase’,’VariableNames’,{‘VariantID’,’Joint Base’});
jointbase = jointbase(ismember(jointbase.VariantID,VariantIDPassed),:);
jointcolumn = table((1:numel(jointcolumn))’,jointcolumn’,’VariableNames’,{‘VariantID’,’Joint Column’});
jointcolumn = jointcolumn(ismember(jointcolumn.VariantID,VariantIDPassed),:);
jointtopordinarysegment = table((1:numel(jointtopordinarysegment))’,jointtopordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Top Ordinary Segment’});
jointtopordinarysegment = jointtopordinarysegment(ismember(jointtopordinarysegment.VariantID,VariantIDPassed),:);
jointbottomordinarysegment = table((1:numel(jointbottomordinarysegment))’,jointbottomordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Ordinary Segment’});
jointbottomordinarysegment = jointbottomordinarysegment(ismember(jointbottomordinarysegment.VariantID,VariantIDPassed),:);
jointtopspecialsegment = table((1:numel(jointtopspecialsegment))’,jointtopspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Top Special Segment’});
jointtopspecialsegment = jointtopspecialsegment(ismember(jointtopspecialsegment.VariantID,VariantIDPassed),:);
jointbottomspecialsegment = table((1:numel(jointbottomspecialsegment))’,jointbottomspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Special Segment’});
jointbottomspecialsegment = jointbottomspecialsegment(ismember(jointbottomspecialsegment.VariantID,VariantIDPassed),:);
Zbottombeam{ijk} = table((1:numel(Zbottombeam{ijk,:}))’,Zbottombeam{ijk,:}’,’VariableNames’,{‘VariantID’,’Z Bottom Beam’});
Zbottombeam = Zbottombeam(VariantIDPassed);
%% Name the Frame
% column
for i = 1:height(VariantIDPassed)
jointIcolumn = 0;
jointJcolumn = 0;
jointcolumnnew{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointcolumnnew{i,:} = vertcat(jointbase.("Joint Base"){i},jointcolumnnew{i});
for j = 1:height(jointcolumnnew{i,1})-2
jointIcolumn(j) = jointcolumnnew{i,1}.ID(j);
jointJcolumn(j) = jointcolumnnew{i,1}.ID(j+2);
end
framecolumn{i,:} = table((1:j)’,jointIcolumn’,jointJcolumn’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
%% Name the Frame
% top ordinary segment (TOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endTOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointTOS{i,:} = vertcat(jointtopordinarysegment.("Joint Top Ordinary Segment"){i},endTOS{i});
jointTOSnew1{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H),:),2);
jointTOSnew2{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H*Ns),:),2);
jointTOSnew{i,:} = vertcat(jointTOSnew1{i},jointTOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew1{i,1})-1
jointI(j) = jointTOSnew1{i,1}.ID(j);
jointJ(j) = jointTOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(framecolumn{i,1}.("Frame ID"));
frameTOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS1{i,1}(median(1:height(frameTOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew2{i,1})-1
jointI(j) = jointTOSnew2{i,1}.ID(j);
jointJ(j) = jointTOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS1{i,1}.("Frame ID"));
frameTOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS2{i,1}(median(1:height(frameTOS2{i,1})),:) = [];
end
frameTOS = cellfun(@(varargin)vertcat(varargin{:}),frameTOS1,frameTOS2,’UniformOutput’,false);
%% Name the Frame
% bottom ordinary segment (BOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endBOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i}.Z),:);
jointBOS{i,:} = vertcat(jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i},endBOS{i});
jointBOSnew1{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(1)),:),2);
jointBOSnew2{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(2)),:),2);
jointBOSnew{i,:} = vertcat(jointBOSnew1{i},jointBOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBOSnew1{i,1})-1
jointI(j) = jointBOSnew1{i,1}.ID(j);
jointJ(j) = jointBOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS{i,1}.("Frame ID"));
frameBOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS1{i,1}(median(1:height(frameBOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ =0;
for j = 1:height(jointBOSnew2{i,1})-1
jointI(j) = jointBOSnew2{i,1}.ID(j);
jointJ(j) = jointBOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS1{i,1}.("Frame ID"));
frameBOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS2{i,1}(median(1:height(frameBOS2{i,1})),:) = [];
end
frameBOS = cellfun(@(varargin)vertcat(varargin{:}),frameBOS1,frameBOS2,’UniformOutput’,false);
%% Name the Frame
% top special segment (TSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointTSSnew1{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H),:),2);
jointTSSnew2{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H*Ns),:),2);
jointTSSnew{i,:} = vertcat(jointTSSnew1{i},jointTSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew1{i,1})-1
jointI(j) = jointTSSnew1{i,1}.ID(j);
jointJ(j) = jointTSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS{i,1}.("Frame ID"));
frameTSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew2{i,1})-1
jointI(j) = jointTSSnew2{i,1}.ID(j);
jointJ(j) = jointTSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS1{i,1}.("Frame ID"));
frameTSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameTSS = cellfun(@(varargin)vertcat(varargin{:}),frameTSS1,frameTSS2,’UniformOutput’,false);
%% Name the Frame
% bottom special segment (BSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointBSSnew1{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(1)),:),2);
jointBSSnew2{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(2)),:),2);
jointBSSnew{i,:} = vertcat(jointBSSnew1{i},jointBSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew1{i,1})-1
jointI(j) = jointBSSnew1{i,1}.ID(j);
jointJ(j) = jointBSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS{i,1}.("Frame ID"));
frameBSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew2{i,1})-1
jointI(j) = jointBSSnew2{i,1}.ID(j);
jointJ(j) = jointBSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBSS1{i,1}.("Frame ID"));
frameBSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameBSS = cellfun(@(varargin)vertcat(varargin{:}),frameBSS1,frameBSS2,’UniformOutput’,false);
%% Name the Frame
% diagonal ordinary segment (DOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tosleft{i,:} = frameTOS{i,1}(1:2:end,:);
tosright{i,:} = frameTOS{i,1}(2:2:end,:);
bosleft{i,:} = frameBOS{i,1}(1:2:end,:);
bosright{i,:} = frameBOS{i,1}(2:2:end,:);
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tosleft{i,1})
jointI(j) = tosleft{i,1}.JointI(j);
jointJ(j) = bosleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameBSS{i,1}.("Frame ID"));
frameDOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bosright{i,1})
jointI(j) = bosright{i,1}.JointI(j);
jointJ(j) = tosright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS1{i,1}.("Frame ID"));
frameDOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDOS = cellfun(@(varargin)vertcat(varargin{:}),frameDOS1,frameDOS2,’UniformOutput’,false);
%% Name the Frame
% diagonal special segment (DSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
tssright{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
bssright{i,:} = frameBSS{i,1};
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS{i,1}.("Frame ID"));
frameDSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bssright{i,1})
jointI(j) = bssright{i,1}.JointI(j);
jointJ(j) = tssright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDSS1{i,1}.("Frame ID"));
frameDSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDSS = cellfun(@(varargin)vertcat(varargin{:}),frameDSS1,frameDSS2,’UniformOutput’,false);
%% Name the Frame
% vertical special segment (VSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
endtss1{i,:} = max(jointTSSnew1{i,1}.ID);
endtss2{i,:} = max(jointTSSnew2{i,1}.ID);
endbss1{i,:} = max(jointBSSnew1{i,1}.ID);
endbss2{i,:} = max(jointBSSnew2{i,1}.ID);
endtss{i,:} = vertcat(endtss1{i},endtss2{i});
endbss{i,:} = vertcat(endbss1{i},endbss2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointI(j);
end
lastframenumber{i,:} = max(frameDSS{i,1}.("Frame ID"));
frameVSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:NumberStory
jointI(j) = endtss{i,:}(j);
jointJ(j) = endbss{i,:}(j);
end
lastframenumber{i,:} = max(frameVSS1{i,1}.("Frame ID"));
frameVSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameVSS = cellfun(@(varargin)vertcat(varargin{:}),frameVSS1,frameVSS2,’UniformOutput’,false);
%% Print ‘frame’ data to textline
txtframeCOLUMN = strings(height(framecolumn),1);
for i = 1:height(framecolumn)
T = framecolumn{i};
M = T{:,:};
txtframeCOLUMN(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTOS = strings(height(frameTOS),1);
for i = 1:height(frameTOS)
T = frameTOS{i};
M = T{:,:};
txtframeTOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBOS = strings(height(frameBOS),1);
for i = 1:height(frameBOS)
T = frameBOS{i};
M = T{:,:};
txtframeBOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTSS = strings(height(frameTSS),1);
for i = 1:height(frameTSS)
T = frameTSS{i};
M = T{:,:};
txtframeTSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBSS = strings(height(frameBSS),1);
for i = 1:height(frameBSS)
T = frameBSS{i};
M = T{:,:};
txtframeBSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDOS = strings(height(frameDOS),1);
for i = 1:height(frameDOS)
T = frameDOS{i};
M = T{:,:};
txtframeDOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDSS = strings(height(frameDSS),1);
for i = 1:height(frameDSS)
T = frameDSS{i};
M = T{:,:};
txtframeDSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeVSS = strings(height(frameVSS),1);
for i = 1:height(frameVSS)
T = frameVSS{i};
M = T{:,:};
txtframeVSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
%% Print ‘joint’ data to textline
txtjointBASE = strings(height(jointbase),1);
for i = 1:height(jointbase)
T = jointbase.("Joint Base"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBASE(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointCOLUMN = strings(height(jointcolumn),1);
for i = 1:height(jointcolumn)
T = jointcolumn.("Joint Column"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointCOLUMN(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTOS = strings(height(jointtopordinarysegment),1);
for i = 1:height(jointtopordinarysegment)
T = jointtopordinarysegment.("Joint Top Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBOS = strings(height(jointbottomordinarysegment),1);
for i = 1:height(jointbottomordinarysegment)
T = jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTSS = strings(height(jointtopspecialsegment),1);
for i = 1:height(jointtopspecialsegment)
T = jointtopspecialsegment.("Joint Top Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBSS = strings(height(jointbottomspecialsegment),1);
for i = 1:height(jointbottomspecialsegment)
T = jointbottomspecialsegment.("Joint Bottom Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
%% WRITE s2k Extension Files
VariantModel = compose(‘%d’, 1:height(VariantIDPassed));
lined= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
for i = 1:numel(VariantModel)
writefile(VariantModel{i},txtjointBASE{i},txtjointCOLUMN{i},txtjointTOS{i},txtjointBOS{i},txtjointTSS{i},txtjointBSS{i},txtframeCOLUMN{i},txtframeTOS{i},txtframeBOS{i},txtframeTSS{i},txtframeBSS{i},txtframeDOS{i},txtframeDSS{i},txtframeVSS{i});
end
files = dir(‘*.s2k’);
files(:).name;
function writefile(C,txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS,txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS)
fido = fopen("ModelVariant"+C+".s2k",’wt’);
newline = ‘n’;
line1=’File D:\MAGISTER\KULIAH\TESIS\S2K FILE\ModelVariant-%d.s2k was saved on m/d/yy at h:mm:ss’;
line2=’TABLE: "PROGRAM CONTROL"’;
line3=’ ProgramName=SAP2000 Version=25.0.0 ProgLevel=Ultimate LicenseNum=3010*1D6KZBK478DMQCT LicenseOS=Yes LicenseSC=Yes LicenseHT=No CurrUnits="KN, m, C" SteelCode="AISC 360-10" ConcCode="ACI 318-19" AlumCode="AA 2015" _’;
line4=’ ColdCode=AISI-16 RegenHinge=Yes’;
line5=’TABLE: "ACTIVE DEGREES OF FREEDOM"’;
line6=’ UX=Yes UY=No UZ=Yes RX=No RY=Yes RZ=No’;
line7=’TABLE: "ANALYSIS OPTIONS"’;
line8=’ Solver=Multithreaded SolverProc="Analysis Process" NumParallel=0 Force32Bit=No StiffCase=None GeomMod=None HingeOpt="In Elements" NumAThreads=0 MaxFileSize=0 NumDThreads=0 NumRThreads=0 _ UseMMFiles="Program Determined" AllowDiff=No’;
line9=’TABLE: "COORDINATE SYSTEMS"’;
line10=’ Name=GLOBAL Type=Cartesian X=0 Y=0 Z=0 AboutZ=0 AboutY=0 AboutX=0′;
line11=’TABLE: "GRID LINES"’;
line12=’ CoordSys=GLOBAL AxisDir=X GridID=A XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End AllVisible=Yes BubbleSize=1,5′;
line13=’ CoordSys=GLOBAL AxisDir=X GridID=B XRYZCoord=15 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line14=’ CoordSys=GLOBAL AxisDir=X GridID=C XRYZCoord=30 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line15=’ CoordSys=GLOBAL AxisDir=Y GridID=1 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=Start’;
line16=’ CoordSys=GLOBAL AxisDir=Z GridID=Z0 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line17=’ CoordSys=GLOBAL AxisDir=Z GridID=Z1 XRYZCoord=5 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line18=’ CoordSys=GLOBAL AxisDir=Z GridID=Z2 XRYZCoord=10 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line19=’TABLE: "MATERIAL PROPERTIES 01 – GENERAL"’;
line20=’ Material=4000Psi Type=Concrete Grade="’ + "f’c 4000 " + ‘psi"’+ ‘ SymType=Isotropic TempDepend=No Color=Green GUID=b0920fc0-a39b-46e4-a096-037f0f0739a7 Notes="Customary ‘+"f’c 4000 psi "+’01/02/2024 20:13:33"’;
line21=’ Material=BJ-37 Type=Steel Grade="Grade 50" SymType=Isotropic TempDepend=No Color=Magenta Notes="ASTM A992 Grade 50 01/02/2024 20:03:34"’;
line22=’TABLE: "MATERIAL PROPERTIES 02 – BASIC MECHANICAL PROPERTIES"’;
line23=’ Material=4000Psi UnitWeight=23,5631216161854 UnitMass=2,40276960558926 E1=24855578,0600518 G12=10356490,8583549 U12=0,2 A1=9,89999952793124E-06′;
line24=’ Material=BJ-37 UnitWeight=76,9728639422648 UnitMass=7,84904737995992 E1=199947978,795958 G12=76903068,7676762 U12=0,3 A1=1,16999994421006E-05′;
line25=’TABLE: "MATERIAL PROPERTIES 03A – STEEL DATA"’;
line26=’ Material=BJ-37 Fy=235000 Fu=352500 EffFy=235000 EffFu=352500 SSCurveOpt=Simple SSHysType=Kinematic SHard=0,015 SMax=0,11 SRup=0,17 FinalSlope=-0,1 CoupModType="Von Mises"’;
line27=’TABLE: "MATERIAL PROPERTIES 06 – DAMPING PARAMETERS"’;
line28=’ Material=4000Psi ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line29=’ Material=BJ-37 ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line30=’TABLE: "MATERIAL PROPERTIES 09 – ACCEPTANCE CRITERIA"’;
line31=’ Material=4000Psi IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,003 LSComp=-0,006 CPComp=-0,015 IgnoreTens=Yes’;
line32=’ Material=BJ-37 IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,005 LSComp=-0,01 CPComp=-0,02′;
line33=’TABLE: "FRAME SECTION PROPERTIES 01 – GENERAL"’;
line34=’ SectionName=ExampleWideFlanged Material=BJ-37 Shape="I/Wide Flange" t3=0,25 t2=0,15 tf=0,012 tw=0,008 t2b=0,15 tfb=0,012 FilletRadius=0,012 Area=0,005552 TorsConst=2,13418666666667E-07 I33=6,04638656154112E-05 _’;
line35=’ I22=6,76749435145855E-06 I23=-6,7762635780344E-21 AS2=0,00200790111881035 AS3=0,00357344416053972 S33Top=0,00048371092492329 S33Bot=0,00048371092492329 S22Left=9,02332580194473E-05 S22Right=9,02332580194473E-05 _’;
line36=’ Z33=0,000546402338734841 Z22=0,00013961366126516 R33=0,10435739412628 R22=0,0349131651083826 CGOffset3=-1,38777878078145E-17 CGOffset2=5,55111512312578E-17 EccV2=0 EccV3=0 Cw=9,558675E-08 ConcCol=No ConcBeam=No _’;
line37=’ Color=Blue TotalWt=60,3707599671425 TotalMass=6,15610399662034 FromFile=No AMod=1 A2Mod=1 A3Mod=1 JMod=1 I2Mod=1 I3Mod=1 MMod=1 WMod=1 Notes="Added 03/04/2024 20:08:55′;
line38=’TABLE: "LOAD PATTERN DEFINITIONS"’;
line39=’ LoadPat=DEAD DesignType=Dead SelfWtMult=1 GUID=d2c74fc0-a771-416d-b3dc-4b0a2047268d’;
line40=’ LoadPat=SUPERDEAD DesignType="Super Dead" SelfWtMult=0 GUID=91534b51-672f-4fb0-a037-d7225de00c69 Notes="Added 01/02/2024 20:08:11"’;
line41=’ LoadPat=LIVE DesignType=Live SelfWtMult=0 GUID=1f6f6fd1-e0f1-4fcb-bf3d-dc86bd53f1a8 Notes="Added 01/02/2024 20:08:16"’;
line42=’TABLE: "GROUPS 1 – DEFINITIONS"’;
line43=’ GroupName=All Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line44=’ GroupName=ST_Top Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line45=’ GroupName=ST_Bot Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line46=’ GroupName=ST_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line47=’ GroupName=ST_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line48=’ GroupName=OT_Top1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line49=’ GroupName=OT_Top2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Yellow’;
line49a=’ GroupName=OT_Bot1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line49b=’ GroupName=OT_Bot2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line49c=’ GroupName=OT_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line49d=’ GroupName=OT_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line49e=’ GroupName=Column_End Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line50=’TABLE: "JOINT PATTERN DEFINITIONS"’;
line51=’ Pattern=Default’;
line52=’TABLE: "MASS SOURCE"’;
line53=’ MassSource=MSSSRC1 Elements=Yes Masses=Yes Loads=Yes IsDefault=Yes LoadPat=DEAD Multiplier=1′;
line54=’ MassSource=MSSSRC1 LoadPat=SUPERDEAD Multiplier=1′;
line55=’ MassSource=MSSSRC1 LoadPat=LIVE Multiplier=0,5′;
line56=’TABLE: "LOAD CASE DEFINITIONS"’;
line57=’ Case=DEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=91b91585-f6e6-446e-ac30-362013fd8af9′;
line58=’ Case=MODAL Type=LinModal InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Other DesActOpt="Prog Det" DesignAct=Other AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=3e160405-efbf-45fb-ae06-c6da634ca183′;
line59=’ Case=SUPERDEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType="Super Dead" DesActOpt="Prog Det" DesignAct="Long-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=2ca565b7-af73-42e9-9208-0a0739594699′;
line60=’ Case=LIVE Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Live DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e969dd8f-56cc-40d7-af8a-0fba39157fcb’;
line61=’ Case="Gravity NLS" Type=NonStatic InitialCond=Zero MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line62=’ Case=Pushover-UX Type=NonStatic InitialCond="Gravity NLS" MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Quake DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line63=’TABLE: "CASE – STATIC 1 – LOAD ASSIGNMENTS"’;
line64=’ Case=DEAD LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line65=’ Case=SUPERDEAD LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line66=’ Case=LIVE LoadType="Load pattern" LoadName=LIVE LoadSF=1′;
line67=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line68=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line69=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=LIVE LoadSF=0,5′;
line70=’ Case=Pushover-UX LoadType=Accel LoadName="Accel UX" TransAccSF=-1′;
line71=’TABLE: "CASE – STATIC 2 – NONLINEAR LOAD APPLICATION"’;
line72=’ Case="Gravity NLS" LoadApp="Full Load" MonitorDOF=U1 MonitorJt=9′;
line73=’ Case=Pushover-UX LoadApp="Displ Ctrl" DisplType=Monitored TargetDispl=1 MonitorDOF=U1 MonitorJt=9′;
line74=’TABLE: "CASE – STATIC 4 – NONLINEAR PARAMETERS"’;
line75=’ Case="Gravity NLS" GeoNonLin=P-Delta ResultsSave="Final State" SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 _’;
line76=’ TFAccelFact=1 TFNoStop=No’;
line77=’ Case=Pushover-UX GeoNonLin=P-Delta ResultsSave="Multiple States" MinNumState=10 MaxNumState=100 PosIncOnly=Yes SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 _’;
line78=’ MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 TFAccelFact=1 TFNoStop=No’;
line79=’TABLE: "CASE – MODAL 1 – GENERAL"’;
line80=’ Case=MODAL ModeType=Eigen MaxNumModes=12 MinNumModes=1 EigenShift=0 EigenCutoff=0 EigenTol=1E-09 AutoShift=Yes’;
line81=’TABLE: "JOINT COORDINATES"’;
line82= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
line83=’TABLE: "CONNECTIVITY – FRAME"’;
line84= append(txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS);
line85=’TABLE: "END TABLE DATA"’;
combine1 = append(line1,newline,line2,newline,line3,newline,line4,newline,line5,newline,line6,newline,line7,newline,line8,newline,line9,newline,line10,newline,line11,newline,line12,newline,line13,newline,line14,newline,line15,newline,line16,newline,line17,newline,line18,newline,line19,newline,line20,newline,line21,newline,line22,newline,line23,newline,line24,newline,line25,newline,line26,newline,line27,newline,line28,newline,line29,newline,line30,newline,line31,newline,line32,newline,line33,newline,line34,newline,line35,newline,line36);
combine2 = append(combine1,newline,line37,newline,line38,newline,line39,newline,line40,newline,line41,newline,line42,newline,line43,newline,line44,newline,line45,newline,line46,newline,line47,newline,line48,newline,line49,newline,line49a,newline,line49b,newline,line49c,newline,line49d,newline,line49e,newline,line50,newline,line51,newline,line52,newline,line53,newline,line54,newline,line55,newline,line56,newline,line57,newline,line58,newline,line59,newline,line60,newline,line61,newline,line62,newline,line63,newline,line64,newline,line65,newline,line66,newline,line67,newline,line68,newline);
combine3 = append(combine2,line69,newline,line70,newline,line71,newline,line72,newline,line73,newline,line74,newline,line75,newline,line76,newline,line77,newline,line78,newline,line79,newline,line80,newline,line81,newline,line82,newline,line83,newline,line84,newline,line85);
fprintf(fido,combine3,C);
fclose(fido);
end
and second problem is why the result inside the file is different between when i Run the matlab by stepping (not single-run) and when i do one time running. When i do stepping-run one-by one the result is same with what my ittention. Because each file doesnt do double writing (just end in line no.85 (END TABLE DATA). The result will be like this:
But when i do one-time running it happened like this :
then how to stop double writing like that ?Hi guys, im trying to write a file which contains text that i already defined in Matlab.
I have 2 problems here. First is my numbering inside the file is not match with numbring of my file’s name. You can see the picture below:
Here is my code :
clear;
clc;
H = 5;
L = 15;
Ns = 2;
Nb = 1;
PortalHeight = H;
Bayspan = L;
NumberStory = Ns;
NumberBay = Nb;
% Variable1
h = [0.8,1.00,1.20,1.40,1.6,1.80];
% Variable2
Lss = [2.00,2.40,2.80,3.20,3.60,4.00];
% Variable3
Nss = [2,3,4];
% Definition
Var1HeightofTrussBeam = h;
Var2LengthSpecialSegment = Lss;
Var3NumberSpecialSegment = Nss;
% % Xbase = zeros(1,length(Totalvariant));
% % Zbase = zeros(1,length(Totalvariant));
% % Xcol = zeros(1,length(Totalvariant));
% % Zcol = zeros(1,length(Totalvariant));
% % Xos = zeros(1,length(Totalvariant));
% % Zos = zeros(1,length(Totalvariant));
% % Xss = zeros(1,length(Totalvariant));
% % Zss = zeros(1,length(Totalvariant));
% % X = zeros(1,length(Totalvariant));
% % Z = zeros(1,length(Totalvariant));
% % jointbase = zeros(1,length(Totalvariant));
% % jointcolumn = zeros(1,length(Totalvariant));
% % jointordinarysegment = zeros(1,length(Totalvariant));
% % jointtopordinarysegment = zeros(1,length(Totalvariant));
% % jointbottomordinarysegment = zeros(1,length(Totalvariant));
% % jointspecialsegment = zeros(1,length(Totalvariant));
% % jointtopspecialsegment = zeros(1,length(Totalvariant));
% % jointbottomspecialsegment = zeros(1,length(Totalvariant));
ijk = 0;
for i = 1:numel(h)
for j = 1:numel(Lss)
for k = 1:numel(Nss)
ijk = ijk+1;
Variantmodel{ijk,:} = table(ijk,h(i),Lss(j),Nss(k),’VariableNames’,{‘VariantID’,’Height’,’Length’,’Number’});
%% Cooridinate Point Base(base)
Xbase{ijk,:} = L*(0:NumberBay);
Zbase{ijk,:} = repelem(0,1,length(Xbase{ijk,:}));
%% Column(col)
Xcolumn = L*(0:NumberBay);
Zcolumn = repelem(H*(1:NumberStory),1,length(Xcolumn));
Xbotbeam = L*(0:NumberBay);
Zbotbeam = repelem((H*(1:NumberStory)-h(i)),1,length(Xbotbeam));
idx = unique(Zbotbeam(:).’);
Zbottombeam{ijk,:} = idx;
% replicate [X] to be the same size as [Z] for plotting:
Xcol{ijk,:} = repmat([Xcolumn,Xbotbeam],1,NumberStory);
Zcol{ijk,:} = [Zcolumn,Zbotbeam];
%% Cooridinate Point Ordinary Segment (os)
% calculate span length of ordinary segment
Los = (L-Lss(j))/2;
Nos = Los/h(i);
Nos = round(Nos);
los = Los/Nos;
totalspan{ijk,:} = los*Nos*2+Lss(j);
if totalspan{ijk,:} == 15.000
checkspan{ijk,:} = "correct span";
else
checkspan{ijk,:} = "span must be 15m";
end
% top and bottom joint of ordinary segment(os)
XTopOrdinarySegment = reshape([los*(1:Nos),(L/2+Lss(j)/2)+los*(0:Nos-1)].’+L*(0:(NumberBay-1)),1,[]);
XBottomOrdinarySegment = XTopOrdinarySegment;
ZTopOrdinarySegment = repelem(H*(1:NumberStory),1,2*Nos*NumberBay);
ZBottomOrdinarySegment = repelem(H*(1:NumberStory)-h(i),1,2*Nos*NumberBay);
% replicate [X] to be the same size as [Z] for plotting:
Xos{ijk,:} = repmat([XTopOrdinarySegment,XBottomOrdinarySegment],1,NumberStory);
Zos{ijk,:} = [ZTopOrdinarySegment,ZBottomOrdinarySegment];
%% Cooridinate Point Special Segment (ss)
% calculate span length of special segment
lss = Lss(j)/Nss(k);
% top and bottom joint of special segment(ss)
XTopSpecialSegment = reshape((lss*(0:Nss(k))+L/2-Lss(j)/2).’+L*(0:(NumberBay-1)),1,[]);
XBottomSpecialSegment = XTopSpecialSegment;
ZTopSpecialSegment = repelem(H*(1:NumberStory),1,length(XTopSpecialSegment));
ZBottomSpecialSegment = repelem(H*(1:NumberStory)-h(i),1,length(XBottomSpecialSegment));
% replicate [X] to be the same size as [Z] for plotting:
Xss{ijk,:} = repmat([XTopSpecialSegment,XBottomSpecialSegment],1,NumberStory);
Zss{ijk,:} = [ZTopSpecialSegment,ZBottomSpecialSegment];
%% Plot Cooridinate Point (X,Z)
X{ijk,:} = [Xbase{ijk,:},Xcol{ijk,:},Xos{ijk,:},Xss{ijk,:}];
Z{ijk,:} = [Zbase{ijk,:},Zcol{ijk,:},Zos{ijk,:},Zss{ijk,:}];
scatter(X{ijk,:},Z{ijk,:},’filled’),grid on
%check angle
tangent = (Lss(j)/Nss(k))/h(i);
anglespecialsegment(ijk) = atand(tangent);
%% Name the Joint
jointbase{ijk} = table((1:numel(Xbase{ijk,:}))’,Xbase{ijk,:}’,Zbase{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointcolumn{ijk} = table((max(jointbase{ijk}.ID)+1:numel(Xcol{ijk,:})+max(jointbase{ijk}.ID))’,Xcol{ijk,:}’,Zcol{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointordinarysegment{ijk} = table((max(jointcolumn{ijk}.ID)+1:numel(Xos{ijk,:})+max(jointcolumn{ijk}.ID))’,Xos{ijk,:}’,Zos{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zcolumn),:);
jointbottomordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zbotbeam),:);
jointspecialsegment{ijk} = table((max(jointbottomordinarysegment{ijk}.ID)+1:numel(Xss{ijk,:})+max(jointbottomordinarysegment{ijk}.ID))’,Xss{ijk,:}’,Zss{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zcolumn),:);
jointbottomspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zbotbeam),:);
end
end
end
% Verify Variants Which Passed the Angle Requirement
tablecheck = table((1:numel(anglespecialsegment))’,totalspan,anglespecialsegment’,’VariableNames’,{‘VariantID’,’Total Span’,’Angle’});
VariantIDPassed = tablecheck.VariantID(tablecheck.Angle>=30 & tablecheck.Angle<=60);
jointbase = table((1:numel(jointbase))’,jointbase’,’VariableNames’,{‘VariantID’,’Joint Base’});
jointbase = jointbase(ismember(jointbase.VariantID,VariantIDPassed),:);
jointcolumn = table((1:numel(jointcolumn))’,jointcolumn’,’VariableNames’,{‘VariantID’,’Joint Column’});
jointcolumn = jointcolumn(ismember(jointcolumn.VariantID,VariantIDPassed),:);
jointtopordinarysegment = table((1:numel(jointtopordinarysegment))’,jointtopordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Top Ordinary Segment’});
jointtopordinarysegment = jointtopordinarysegment(ismember(jointtopordinarysegment.VariantID,VariantIDPassed),:);
jointbottomordinarysegment = table((1:numel(jointbottomordinarysegment))’,jointbottomordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Ordinary Segment’});
jointbottomordinarysegment = jointbottomordinarysegment(ismember(jointbottomordinarysegment.VariantID,VariantIDPassed),:);
jointtopspecialsegment = table((1:numel(jointtopspecialsegment))’,jointtopspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Top Special Segment’});
jointtopspecialsegment = jointtopspecialsegment(ismember(jointtopspecialsegment.VariantID,VariantIDPassed),:);
jointbottomspecialsegment = table((1:numel(jointbottomspecialsegment))’,jointbottomspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Special Segment’});
jointbottomspecialsegment = jointbottomspecialsegment(ismember(jointbottomspecialsegment.VariantID,VariantIDPassed),:);
Zbottombeam{ijk} = table((1:numel(Zbottombeam{ijk,:}))’,Zbottombeam{ijk,:}’,’VariableNames’,{‘VariantID’,’Z Bottom Beam’});
Zbottombeam = Zbottombeam(VariantIDPassed);
%% Name the Frame
% column
for i = 1:height(VariantIDPassed)
jointIcolumn = 0;
jointJcolumn = 0;
jointcolumnnew{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointcolumnnew{i,:} = vertcat(jointbase.("Joint Base"){i},jointcolumnnew{i});
for j = 1:height(jointcolumnnew{i,1})-2
jointIcolumn(j) = jointcolumnnew{i,1}.ID(j);
jointJcolumn(j) = jointcolumnnew{i,1}.ID(j+2);
end
framecolumn{i,:} = table((1:j)’,jointIcolumn’,jointJcolumn’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
%% Name the Frame
% top ordinary segment (TOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endTOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointTOS{i,:} = vertcat(jointtopordinarysegment.("Joint Top Ordinary Segment"){i},endTOS{i});
jointTOSnew1{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H),:),2);
jointTOSnew2{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H*Ns),:),2);
jointTOSnew{i,:} = vertcat(jointTOSnew1{i},jointTOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew1{i,1})-1
jointI(j) = jointTOSnew1{i,1}.ID(j);
jointJ(j) = jointTOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(framecolumn{i,1}.("Frame ID"));
frameTOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS1{i,1}(median(1:height(frameTOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew2{i,1})-1
jointI(j) = jointTOSnew2{i,1}.ID(j);
jointJ(j) = jointTOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS1{i,1}.("Frame ID"));
frameTOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS2{i,1}(median(1:height(frameTOS2{i,1})),:) = [];
end
frameTOS = cellfun(@(varargin)vertcat(varargin{:}),frameTOS1,frameTOS2,’UniformOutput’,false);
%% Name the Frame
% bottom ordinary segment (BOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endBOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i}.Z),:);
jointBOS{i,:} = vertcat(jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i},endBOS{i});
jointBOSnew1{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(1)),:),2);
jointBOSnew2{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(2)),:),2);
jointBOSnew{i,:} = vertcat(jointBOSnew1{i},jointBOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBOSnew1{i,1})-1
jointI(j) = jointBOSnew1{i,1}.ID(j);
jointJ(j) = jointBOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS{i,1}.("Frame ID"));
frameBOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS1{i,1}(median(1:height(frameBOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ =0;
for j = 1:height(jointBOSnew2{i,1})-1
jointI(j) = jointBOSnew2{i,1}.ID(j);
jointJ(j) = jointBOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS1{i,1}.("Frame ID"));
frameBOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS2{i,1}(median(1:height(frameBOS2{i,1})),:) = [];
end
frameBOS = cellfun(@(varargin)vertcat(varargin{:}),frameBOS1,frameBOS2,’UniformOutput’,false);
%% Name the Frame
% top special segment (TSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointTSSnew1{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H),:),2);
jointTSSnew2{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H*Ns),:),2);
jointTSSnew{i,:} = vertcat(jointTSSnew1{i},jointTSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew1{i,1})-1
jointI(j) = jointTSSnew1{i,1}.ID(j);
jointJ(j) = jointTSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS{i,1}.("Frame ID"));
frameTSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew2{i,1})-1
jointI(j) = jointTSSnew2{i,1}.ID(j);
jointJ(j) = jointTSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS1{i,1}.("Frame ID"));
frameTSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameTSS = cellfun(@(varargin)vertcat(varargin{:}),frameTSS1,frameTSS2,’UniformOutput’,false);
%% Name the Frame
% bottom special segment (BSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointBSSnew1{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(1)),:),2);
jointBSSnew2{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(2)),:),2);
jointBSSnew{i,:} = vertcat(jointBSSnew1{i},jointBSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew1{i,1})-1
jointI(j) = jointBSSnew1{i,1}.ID(j);
jointJ(j) = jointBSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS{i,1}.("Frame ID"));
frameBSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew2{i,1})-1
jointI(j) = jointBSSnew2{i,1}.ID(j);
jointJ(j) = jointBSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBSS1{i,1}.("Frame ID"));
frameBSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameBSS = cellfun(@(varargin)vertcat(varargin{:}),frameBSS1,frameBSS2,’UniformOutput’,false);
%% Name the Frame
% diagonal ordinary segment (DOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tosleft{i,:} = frameTOS{i,1}(1:2:end,:);
tosright{i,:} = frameTOS{i,1}(2:2:end,:);
bosleft{i,:} = frameBOS{i,1}(1:2:end,:);
bosright{i,:} = frameBOS{i,1}(2:2:end,:);
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tosleft{i,1})
jointI(j) = tosleft{i,1}.JointI(j);
jointJ(j) = bosleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameBSS{i,1}.("Frame ID"));
frameDOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bosright{i,1})
jointI(j) = bosright{i,1}.JointI(j);
jointJ(j) = tosright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS1{i,1}.("Frame ID"));
frameDOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDOS = cellfun(@(varargin)vertcat(varargin{:}),frameDOS1,frameDOS2,’UniformOutput’,false);
%% Name the Frame
% diagonal special segment (DSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
tssright{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
bssright{i,:} = frameBSS{i,1};
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS{i,1}.("Frame ID"));
frameDSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bssright{i,1})
jointI(j) = bssright{i,1}.JointI(j);
jointJ(j) = tssright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDSS1{i,1}.("Frame ID"));
frameDSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDSS = cellfun(@(varargin)vertcat(varargin{:}),frameDSS1,frameDSS2,’UniformOutput’,false);
%% Name the Frame
% vertical special segment (VSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
endtss1{i,:} = max(jointTSSnew1{i,1}.ID);
endtss2{i,:} = max(jointTSSnew2{i,1}.ID);
endbss1{i,:} = max(jointBSSnew1{i,1}.ID);
endbss2{i,:} = max(jointBSSnew2{i,1}.ID);
endtss{i,:} = vertcat(endtss1{i},endtss2{i});
endbss{i,:} = vertcat(endbss1{i},endbss2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointI(j);
end
lastframenumber{i,:} = max(frameDSS{i,1}.("Frame ID"));
frameVSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:NumberStory
jointI(j) = endtss{i,:}(j);
jointJ(j) = endbss{i,:}(j);
end
lastframenumber{i,:} = max(frameVSS1{i,1}.("Frame ID"));
frameVSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameVSS = cellfun(@(varargin)vertcat(varargin{:}),frameVSS1,frameVSS2,’UniformOutput’,false);
%% Print ‘frame’ data to textline
txtframeCOLUMN = strings(height(framecolumn),1);
for i = 1:height(framecolumn)
T = framecolumn{i};
M = T{:,:};
txtframeCOLUMN(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTOS = strings(height(frameTOS),1);
for i = 1:height(frameTOS)
T = frameTOS{i};
M = T{:,:};
txtframeTOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBOS = strings(height(frameBOS),1);
for i = 1:height(frameBOS)
T = frameBOS{i};
M = T{:,:};
txtframeBOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTSS = strings(height(frameTSS),1);
for i = 1:height(frameTSS)
T = frameTSS{i};
M = T{:,:};
txtframeTSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBSS = strings(height(frameBSS),1);
for i = 1:height(frameBSS)
T = frameBSS{i};
M = T{:,:};
txtframeBSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDOS = strings(height(frameDOS),1);
for i = 1:height(frameDOS)
T = frameDOS{i};
M = T{:,:};
txtframeDOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDSS = strings(height(frameDSS),1);
for i = 1:height(frameDSS)
T = frameDSS{i};
M = T{:,:};
txtframeDSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeVSS = strings(height(frameVSS),1);
for i = 1:height(frameVSS)
T = frameVSS{i};
M = T{:,:};
txtframeVSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
%% Print ‘joint’ data to textline
txtjointBASE = strings(height(jointbase),1);
for i = 1:height(jointbase)
T = jointbase.("Joint Base"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBASE(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointCOLUMN = strings(height(jointcolumn),1);
for i = 1:height(jointcolumn)
T = jointcolumn.("Joint Column"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointCOLUMN(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTOS = strings(height(jointtopordinarysegment),1);
for i = 1:height(jointtopordinarysegment)
T = jointtopordinarysegment.("Joint Top Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBOS = strings(height(jointbottomordinarysegment),1);
for i = 1:height(jointbottomordinarysegment)
T = jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTSS = strings(height(jointtopspecialsegment),1);
for i = 1:height(jointtopspecialsegment)
T = jointtopspecialsegment.("Joint Top Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBSS = strings(height(jointbottomspecialsegment),1);
for i = 1:height(jointbottomspecialsegment)
T = jointbottomspecialsegment.("Joint Bottom Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
%% WRITE s2k Extension Files
VariantModel = compose(‘%d’, 1:height(VariantIDPassed));
lined= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
for i = 1:numel(VariantModel)
writefile(VariantModel{i},txtjointBASE{i},txtjointCOLUMN{i},txtjointTOS{i},txtjointBOS{i},txtjointTSS{i},txtjointBSS{i},txtframeCOLUMN{i},txtframeTOS{i},txtframeBOS{i},txtframeTSS{i},txtframeBSS{i},txtframeDOS{i},txtframeDSS{i},txtframeVSS{i});
end
files = dir(‘*.s2k’);
files(:).name;
function writefile(C,txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS,txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS)
fido = fopen("ModelVariant"+C+".s2k",’wt’);
newline = ‘n’;
line1=’File D:\MAGISTER\KULIAH\TESIS\S2K FILE\ModelVariant-%d.s2k was saved on m/d/yy at h:mm:ss’;
line2=’TABLE: "PROGRAM CONTROL"’;
line3=’ ProgramName=SAP2000 Version=25.0.0 ProgLevel=Ultimate LicenseNum=3010*1D6KZBK478DMQCT LicenseOS=Yes LicenseSC=Yes LicenseHT=No CurrUnits="KN, m, C" SteelCode="AISC 360-10" ConcCode="ACI 318-19" AlumCode="AA 2015" _’;
line4=’ ColdCode=AISI-16 RegenHinge=Yes’;
line5=’TABLE: "ACTIVE DEGREES OF FREEDOM"’;
line6=’ UX=Yes UY=No UZ=Yes RX=No RY=Yes RZ=No’;
line7=’TABLE: "ANALYSIS OPTIONS"’;
line8=’ Solver=Multithreaded SolverProc="Analysis Process" NumParallel=0 Force32Bit=No StiffCase=None GeomMod=None HingeOpt="In Elements" NumAThreads=0 MaxFileSize=0 NumDThreads=0 NumRThreads=0 _ UseMMFiles="Program Determined" AllowDiff=No’;
line9=’TABLE: "COORDINATE SYSTEMS"’;
line10=’ Name=GLOBAL Type=Cartesian X=0 Y=0 Z=0 AboutZ=0 AboutY=0 AboutX=0′;
line11=’TABLE: "GRID LINES"’;
line12=’ CoordSys=GLOBAL AxisDir=X GridID=A XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End AllVisible=Yes BubbleSize=1,5′;
line13=’ CoordSys=GLOBAL AxisDir=X GridID=B XRYZCoord=15 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line14=’ CoordSys=GLOBAL AxisDir=X GridID=C XRYZCoord=30 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line15=’ CoordSys=GLOBAL AxisDir=Y GridID=1 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=Start’;
line16=’ CoordSys=GLOBAL AxisDir=Z GridID=Z0 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line17=’ CoordSys=GLOBAL AxisDir=Z GridID=Z1 XRYZCoord=5 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line18=’ CoordSys=GLOBAL AxisDir=Z GridID=Z2 XRYZCoord=10 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line19=’TABLE: "MATERIAL PROPERTIES 01 – GENERAL"’;
line20=’ Material=4000Psi Type=Concrete Grade="’ + "f’c 4000 " + ‘psi"’+ ‘ SymType=Isotropic TempDepend=No Color=Green GUID=b0920fc0-a39b-46e4-a096-037f0f0739a7 Notes="Customary ‘+"f’c 4000 psi "+’01/02/2024 20:13:33"’;
line21=’ Material=BJ-37 Type=Steel Grade="Grade 50" SymType=Isotropic TempDepend=No Color=Magenta Notes="ASTM A992 Grade 50 01/02/2024 20:03:34"’;
line22=’TABLE: "MATERIAL PROPERTIES 02 – BASIC MECHANICAL PROPERTIES"’;
line23=’ Material=4000Psi UnitWeight=23,5631216161854 UnitMass=2,40276960558926 E1=24855578,0600518 G12=10356490,8583549 U12=0,2 A1=9,89999952793124E-06′;
line24=’ Material=BJ-37 UnitWeight=76,9728639422648 UnitMass=7,84904737995992 E1=199947978,795958 G12=76903068,7676762 U12=0,3 A1=1,16999994421006E-05′;
line25=’TABLE: "MATERIAL PROPERTIES 03A – STEEL DATA"’;
line26=’ Material=BJ-37 Fy=235000 Fu=352500 EffFy=235000 EffFu=352500 SSCurveOpt=Simple SSHysType=Kinematic SHard=0,015 SMax=0,11 SRup=0,17 FinalSlope=-0,1 CoupModType="Von Mises"’;
line27=’TABLE: "MATERIAL PROPERTIES 06 – DAMPING PARAMETERS"’;
line28=’ Material=4000Psi ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line29=’ Material=BJ-37 ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line30=’TABLE: "MATERIAL PROPERTIES 09 – ACCEPTANCE CRITERIA"’;
line31=’ Material=4000Psi IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,003 LSComp=-0,006 CPComp=-0,015 IgnoreTens=Yes’;
line32=’ Material=BJ-37 IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,005 LSComp=-0,01 CPComp=-0,02′;
line33=’TABLE: "FRAME SECTION PROPERTIES 01 – GENERAL"’;
line34=’ SectionName=ExampleWideFlanged Material=BJ-37 Shape="I/Wide Flange" t3=0,25 t2=0,15 tf=0,012 tw=0,008 t2b=0,15 tfb=0,012 FilletRadius=0,012 Area=0,005552 TorsConst=2,13418666666667E-07 I33=6,04638656154112E-05 _’;
line35=’ I22=6,76749435145855E-06 I23=-6,7762635780344E-21 AS2=0,00200790111881035 AS3=0,00357344416053972 S33Top=0,00048371092492329 S33Bot=0,00048371092492329 S22Left=9,02332580194473E-05 S22Right=9,02332580194473E-05 _’;
line36=’ Z33=0,000546402338734841 Z22=0,00013961366126516 R33=0,10435739412628 R22=0,0349131651083826 CGOffset3=-1,38777878078145E-17 CGOffset2=5,55111512312578E-17 EccV2=0 EccV3=0 Cw=9,558675E-08 ConcCol=No ConcBeam=No _’;
line37=’ Color=Blue TotalWt=60,3707599671425 TotalMass=6,15610399662034 FromFile=No AMod=1 A2Mod=1 A3Mod=1 JMod=1 I2Mod=1 I3Mod=1 MMod=1 WMod=1 Notes="Added 03/04/2024 20:08:55′;
line38=’TABLE: "LOAD PATTERN DEFINITIONS"’;
line39=’ LoadPat=DEAD DesignType=Dead SelfWtMult=1 GUID=d2c74fc0-a771-416d-b3dc-4b0a2047268d’;
line40=’ LoadPat=SUPERDEAD DesignType="Super Dead" SelfWtMult=0 GUID=91534b51-672f-4fb0-a037-d7225de00c69 Notes="Added 01/02/2024 20:08:11"’;
line41=’ LoadPat=LIVE DesignType=Live SelfWtMult=0 GUID=1f6f6fd1-e0f1-4fcb-bf3d-dc86bd53f1a8 Notes="Added 01/02/2024 20:08:16"’;
line42=’TABLE: "GROUPS 1 – DEFINITIONS"’;
line43=’ GroupName=All Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line44=’ GroupName=ST_Top Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line45=’ GroupName=ST_Bot Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line46=’ GroupName=ST_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line47=’ GroupName=ST_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line48=’ GroupName=OT_Top1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line49=’ GroupName=OT_Top2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Yellow’;
line49a=’ GroupName=OT_Bot1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line49b=’ GroupName=OT_Bot2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line49c=’ GroupName=OT_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line49d=’ GroupName=OT_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line49e=’ GroupName=Column_End Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line50=’TABLE: "JOINT PATTERN DEFINITIONS"’;
line51=’ Pattern=Default’;
line52=’TABLE: "MASS SOURCE"’;
line53=’ MassSource=MSSSRC1 Elements=Yes Masses=Yes Loads=Yes IsDefault=Yes LoadPat=DEAD Multiplier=1′;
line54=’ MassSource=MSSSRC1 LoadPat=SUPERDEAD Multiplier=1′;
line55=’ MassSource=MSSSRC1 LoadPat=LIVE Multiplier=0,5′;
line56=’TABLE: "LOAD CASE DEFINITIONS"’;
line57=’ Case=DEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=91b91585-f6e6-446e-ac30-362013fd8af9′;
line58=’ Case=MODAL Type=LinModal InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Other DesActOpt="Prog Det" DesignAct=Other AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=3e160405-efbf-45fb-ae06-c6da634ca183′;
line59=’ Case=SUPERDEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType="Super Dead" DesActOpt="Prog Det" DesignAct="Long-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=2ca565b7-af73-42e9-9208-0a0739594699′;
line60=’ Case=LIVE Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Live DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e969dd8f-56cc-40d7-af8a-0fba39157fcb’;
line61=’ Case="Gravity NLS" Type=NonStatic InitialCond=Zero MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line62=’ Case=Pushover-UX Type=NonStatic InitialCond="Gravity NLS" MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Quake DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line63=’TABLE: "CASE – STATIC 1 – LOAD ASSIGNMENTS"’;
line64=’ Case=DEAD LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line65=’ Case=SUPERDEAD LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line66=’ Case=LIVE LoadType="Load pattern" LoadName=LIVE LoadSF=1′;
line67=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line68=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line69=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=LIVE LoadSF=0,5′;
line70=’ Case=Pushover-UX LoadType=Accel LoadName="Accel UX" TransAccSF=-1′;
line71=’TABLE: "CASE – STATIC 2 – NONLINEAR LOAD APPLICATION"’;
line72=’ Case="Gravity NLS" LoadApp="Full Load" MonitorDOF=U1 MonitorJt=9′;
line73=’ Case=Pushover-UX LoadApp="Displ Ctrl" DisplType=Monitored TargetDispl=1 MonitorDOF=U1 MonitorJt=9′;
line74=’TABLE: "CASE – STATIC 4 – NONLINEAR PARAMETERS"’;
line75=’ Case="Gravity NLS" GeoNonLin=P-Delta ResultsSave="Final State" SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 _’;
line76=’ TFAccelFact=1 TFNoStop=No’;
line77=’ Case=Pushover-UX GeoNonLin=P-Delta ResultsSave="Multiple States" MinNumState=10 MaxNumState=100 PosIncOnly=Yes SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 _’;
line78=’ MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 TFAccelFact=1 TFNoStop=No’;
line79=’TABLE: "CASE – MODAL 1 – GENERAL"’;
line80=’ Case=MODAL ModeType=Eigen MaxNumModes=12 MinNumModes=1 EigenShift=0 EigenCutoff=0 EigenTol=1E-09 AutoShift=Yes’;
line81=’TABLE: "JOINT COORDINATES"’;
line82= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
line83=’TABLE: "CONNECTIVITY – FRAME"’;
line84= append(txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS);
line85=’TABLE: "END TABLE DATA"’;
combine1 = append(line1,newline,line2,newline,line3,newline,line4,newline,line5,newline,line6,newline,line7,newline,line8,newline,line9,newline,line10,newline,line11,newline,line12,newline,line13,newline,line14,newline,line15,newline,line16,newline,line17,newline,line18,newline,line19,newline,line20,newline,line21,newline,line22,newline,line23,newline,line24,newline,line25,newline,line26,newline,line27,newline,line28,newline,line29,newline,line30,newline,line31,newline,line32,newline,line33,newline,line34,newline,line35,newline,line36);
combine2 = append(combine1,newline,line37,newline,line38,newline,line39,newline,line40,newline,line41,newline,line42,newline,line43,newline,line44,newline,line45,newline,line46,newline,line47,newline,line48,newline,line49,newline,line49a,newline,line49b,newline,line49c,newline,line49d,newline,line49e,newline,line50,newline,line51,newline,line52,newline,line53,newline,line54,newline,line55,newline,line56,newline,line57,newline,line58,newline,line59,newline,line60,newline,line61,newline,line62,newline,line63,newline,line64,newline,line65,newline,line66,newline,line67,newline,line68,newline);
combine3 = append(combine2,line69,newline,line70,newline,line71,newline,line72,newline,line73,newline,line74,newline,line75,newline,line76,newline,line77,newline,line78,newline,line79,newline,line80,newline,line81,newline,line82,newline,line83,newline,line84,newline,line85);
fprintf(fido,combine3,C);
fclose(fido);
end
and second problem is why the result inside the file is different between when i Run the matlab by stepping (not single-run) and when i do one time running. When i do stepping-run one-by one the result is same with what my ittention. Because each file doesnt do double writing (just end in line no.85 (END TABLE DATA). The result will be like this:
But when i do one-time running it happened like this :
then how to stop double writing like that ? Hi guys, im trying to write a file which contains text that i already defined in Matlab.
I have 2 problems here. First is my numbering inside the file is not match with numbring of my file’s name. You can see the picture below:
Here is my code :
clear;
clc;
H = 5;
L = 15;
Ns = 2;
Nb = 1;
PortalHeight = H;
Bayspan = L;
NumberStory = Ns;
NumberBay = Nb;
% Variable1
h = [0.8,1.00,1.20,1.40,1.6,1.80];
% Variable2
Lss = [2.00,2.40,2.80,3.20,3.60,4.00];
% Variable3
Nss = [2,3,4];
% Definition
Var1HeightofTrussBeam = h;
Var2LengthSpecialSegment = Lss;
Var3NumberSpecialSegment = Nss;
% % Xbase = zeros(1,length(Totalvariant));
% % Zbase = zeros(1,length(Totalvariant));
% % Xcol = zeros(1,length(Totalvariant));
% % Zcol = zeros(1,length(Totalvariant));
% % Xos = zeros(1,length(Totalvariant));
% % Zos = zeros(1,length(Totalvariant));
% % Xss = zeros(1,length(Totalvariant));
% % Zss = zeros(1,length(Totalvariant));
% % X = zeros(1,length(Totalvariant));
% % Z = zeros(1,length(Totalvariant));
% % jointbase = zeros(1,length(Totalvariant));
% % jointcolumn = zeros(1,length(Totalvariant));
% % jointordinarysegment = zeros(1,length(Totalvariant));
% % jointtopordinarysegment = zeros(1,length(Totalvariant));
% % jointbottomordinarysegment = zeros(1,length(Totalvariant));
% % jointspecialsegment = zeros(1,length(Totalvariant));
% % jointtopspecialsegment = zeros(1,length(Totalvariant));
% % jointbottomspecialsegment = zeros(1,length(Totalvariant));
ijk = 0;
for i = 1:numel(h)
for j = 1:numel(Lss)
for k = 1:numel(Nss)
ijk = ijk+1;
Variantmodel{ijk,:} = table(ijk,h(i),Lss(j),Nss(k),’VariableNames’,{‘VariantID’,’Height’,’Length’,’Number’});
%% Cooridinate Point Base(base)
Xbase{ijk,:} = L*(0:NumberBay);
Zbase{ijk,:} = repelem(0,1,length(Xbase{ijk,:}));
%% Column(col)
Xcolumn = L*(0:NumberBay);
Zcolumn = repelem(H*(1:NumberStory),1,length(Xcolumn));
Xbotbeam = L*(0:NumberBay);
Zbotbeam = repelem((H*(1:NumberStory)-h(i)),1,length(Xbotbeam));
idx = unique(Zbotbeam(:).’);
Zbottombeam{ijk,:} = idx;
% replicate [X] to be the same size as [Z] for plotting:
Xcol{ijk,:} = repmat([Xcolumn,Xbotbeam],1,NumberStory);
Zcol{ijk,:} = [Zcolumn,Zbotbeam];
%% Cooridinate Point Ordinary Segment (os)
% calculate span length of ordinary segment
Los = (L-Lss(j))/2;
Nos = Los/h(i);
Nos = round(Nos);
los = Los/Nos;
totalspan{ijk,:} = los*Nos*2+Lss(j);
if totalspan{ijk,:} == 15.000
checkspan{ijk,:} = "correct span";
else
checkspan{ijk,:} = "span must be 15m";
end
% top and bottom joint of ordinary segment(os)
XTopOrdinarySegment = reshape([los*(1:Nos),(L/2+Lss(j)/2)+los*(0:Nos-1)].’+L*(0:(NumberBay-1)),1,[]);
XBottomOrdinarySegment = XTopOrdinarySegment;
ZTopOrdinarySegment = repelem(H*(1:NumberStory),1,2*Nos*NumberBay);
ZBottomOrdinarySegment = repelem(H*(1:NumberStory)-h(i),1,2*Nos*NumberBay);
% replicate [X] to be the same size as [Z] for plotting:
Xos{ijk,:} = repmat([XTopOrdinarySegment,XBottomOrdinarySegment],1,NumberStory);
Zos{ijk,:} = [ZTopOrdinarySegment,ZBottomOrdinarySegment];
%% Cooridinate Point Special Segment (ss)
% calculate span length of special segment
lss = Lss(j)/Nss(k);
% top and bottom joint of special segment(ss)
XTopSpecialSegment = reshape((lss*(0:Nss(k))+L/2-Lss(j)/2).’+L*(0:(NumberBay-1)),1,[]);
XBottomSpecialSegment = XTopSpecialSegment;
ZTopSpecialSegment = repelem(H*(1:NumberStory),1,length(XTopSpecialSegment));
ZBottomSpecialSegment = repelem(H*(1:NumberStory)-h(i),1,length(XBottomSpecialSegment));
% replicate [X] to be the same size as [Z] for plotting:
Xss{ijk,:} = repmat([XTopSpecialSegment,XBottomSpecialSegment],1,NumberStory);
Zss{ijk,:} = [ZTopSpecialSegment,ZBottomSpecialSegment];
%% Plot Cooridinate Point (X,Z)
X{ijk,:} = [Xbase{ijk,:},Xcol{ijk,:},Xos{ijk,:},Xss{ijk,:}];
Z{ijk,:} = [Zbase{ijk,:},Zcol{ijk,:},Zos{ijk,:},Zss{ijk,:}];
scatter(X{ijk,:},Z{ijk,:},’filled’),grid on
%check angle
tangent = (Lss(j)/Nss(k))/h(i);
anglespecialsegment(ijk) = atand(tangent);
%% Name the Joint
jointbase{ijk} = table((1:numel(Xbase{ijk,:}))’,Xbase{ijk,:}’,Zbase{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointcolumn{ijk} = table((max(jointbase{ijk}.ID)+1:numel(Xcol{ijk,:})+max(jointbase{ijk}.ID))’,Xcol{ijk,:}’,Zcol{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointordinarysegment{ijk} = table((max(jointcolumn{ijk}.ID)+1:numel(Xos{ijk,:})+max(jointcolumn{ijk}.ID))’,Xos{ijk,:}’,Zos{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zcolumn),:);
jointbottomordinarysegment{ijk} = jointordinarysegment{ijk}(ismember(jointordinarysegment{ijk}.Z,Zbotbeam),:);
jointspecialsegment{ijk} = table((max(jointbottomordinarysegment{ijk}.ID)+1:numel(Xss{ijk,:})+max(jointbottomordinarysegment{ijk}.ID))’,Xss{ijk,:}’,Zss{ijk,:}’,’VariableNames’,{‘ID’,’X’,’Z’});
jointtopspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zcolumn),:);
jointbottomspecialsegment{ijk} = jointspecialsegment{ijk}(ismember(jointspecialsegment{ijk}.Z,Zbotbeam),:);
end
end
end
% Verify Variants Which Passed the Angle Requirement
tablecheck = table((1:numel(anglespecialsegment))’,totalspan,anglespecialsegment’,’VariableNames’,{‘VariantID’,’Total Span’,’Angle’});
VariantIDPassed = tablecheck.VariantID(tablecheck.Angle>=30 & tablecheck.Angle<=60);
jointbase = table((1:numel(jointbase))’,jointbase’,’VariableNames’,{‘VariantID’,’Joint Base’});
jointbase = jointbase(ismember(jointbase.VariantID,VariantIDPassed),:);
jointcolumn = table((1:numel(jointcolumn))’,jointcolumn’,’VariableNames’,{‘VariantID’,’Joint Column’});
jointcolumn = jointcolumn(ismember(jointcolumn.VariantID,VariantIDPassed),:);
jointtopordinarysegment = table((1:numel(jointtopordinarysegment))’,jointtopordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Top Ordinary Segment’});
jointtopordinarysegment = jointtopordinarysegment(ismember(jointtopordinarysegment.VariantID,VariantIDPassed),:);
jointbottomordinarysegment = table((1:numel(jointbottomordinarysegment))’,jointbottomordinarysegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Ordinary Segment’});
jointbottomordinarysegment = jointbottomordinarysegment(ismember(jointbottomordinarysegment.VariantID,VariantIDPassed),:);
jointtopspecialsegment = table((1:numel(jointtopspecialsegment))’,jointtopspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Top Special Segment’});
jointtopspecialsegment = jointtopspecialsegment(ismember(jointtopspecialsegment.VariantID,VariantIDPassed),:);
jointbottomspecialsegment = table((1:numel(jointbottomspecialsegment))’,jointbottomspecialsegment’,’VariableNames’,{‘VariantID’,’Joint Bottom Special Segment’});
jointbottomspecialsegment = jointbottomspecialsegment(ismember(jointbottomspecialsegment.VariantID,VariantIDPassed),:);
Zbottombeam{ijk} = table((1:numel(Zbottombeam{ijk,:}))’,Zbottombeam{ijk,:}’,’VariableNames’,{‘VariantID’,’Z Bottom Beam’});
Zbottombeam = Zbottombeam(VariantIDPassed);
%% Name the Frame
% column
for i = 1:height(VariantIDPassed)
jointIcolumn = 0;
jointJcolumn = 0;
jointcolumnnew{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointcolumnnew{i,:} = vertcat(jointbase.("Joint Base"){i},jointcolumnnew{i});
for j = 1:height(jointcolumnnew{i,1})-2
jointIcolumn(j) = jointcolumnnew{i,1}.ID(j);
jointJcolumn(j) = jointcolumnnew{i,1}.ID(j+2);
end
framecolumn{i,:} = table((1:j)’,jointIcolumn’,jointJcolumn’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
%% Name the Frame
% top ordinary segment (TOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endTOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointtopordinarysegment.("Joint Top Ordinary Segment"){i}.Z),:);
jointTOS{i,:} = vertcat(jointtopordinarysegment.("Joint Top Ordinary Segment"){i},endTOS{i});
jointTOSnew1{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H),:),2);
jointTOSnew2{i,:} = sortrows(jointTOS{i}(ismember(jointTOS{i}.Z,H*Ns),:),2);
jointTOSnew{i,:} = vertcat(jointTOSnew1{i},jointTOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew1{i,1})-1
jointI(j) = jointTOSnew1{i,1}.ID(j);
jointJ(j) = jointTOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(framecolumn{i,1}.("Frame ID"));
frameTOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS1{i,1}(median(1:height(frameTOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTOSnew2{i,1})-1
jointI(j) = jointTOSnew2{i,1}.ID(j);
jointJ(j) = jointTOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS1{i,1}.("Frame ID"));
frameTOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameTOS2{i,1}(median(1:height(frameTOS2{i,1})),:) = [];
end
frameTOS = cellfun(@(varargin)vertcat(varargin{:}),frameTOS1,frameTOS2,’UniformOutput’,false);
%% Name the Frame
% bottom ordinary segment (BOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
endBOS{i,:} = jointcolumn.("Joint Column"){i}(ismember(jointcolumn.("Joint Column"){i}.Z,jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i}.Z),:);
jointBOS{i,:} = vertcat(jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i},endBOS{i});
jointBOSnew1{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(1)),:),2);
jointBOSnew2{i,:} = sortrows(jointBOS{i}(ismember(jointBOS{i}.Z,Zbottombeam{i}(2)),:),2);
jointBOSnew{i,:} = vertcat(jointBOSnew1{i},jointBOSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBOSnew1{i,1})-1
jointI(j) = jointBOSnew1{i,1}.ID(j);
jointJ(j) = jointBOSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTOS{i,1}.("Frame ID"));
frameBOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS1{i,1}(median(1:height(frameBOS1{i,1})),:) = [];
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ =0;
for j = 1:height(jointBOSnew2{i,1})-1
jointI(j) = jointBOSnew2{i,1}.ID(j);
jointJ(j) = jointBOSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS1{i,1}.("Frame ID"));
frameBOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
%eliminate special segment
frameBOS2{i,1}(median(1:height(frameBOS2{i,1})),:) = [];
end
frameBOS = cellfun(@(varargin)vertcat(varargin{:}),frameBOS1,frameBOS2,’UniformOutput’,false);
%% Name the Frame
% top special segment (TSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointTSSnew1{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H),:),2);
jointTSSnew2{i,:} = sortrows(jointtopspecialsegment.("Joint Top Special Segment"){i,1}(ismember(jointtopspecialsegment.("Joint Top Special Segment"){i,1}.Z,H*Ns),:),2);
jointTSSnew{i,:} = vertcat(jointTSSnew1{i},jointTSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew1{i,1})-1
jointI(j) = jointTSSnew1{i,1}.ID(j);
jointJ(j) = jointTSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBOS{i,1}.("Frame ID"));
frameTSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointTSSnew2{i,1})-1
jointI(j) = jointTSSnew2{i,1}.ID(j);
jointJ(j) = jointTSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS1{i,1}.("Frame ID"));
frameTSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameTSS = cellfun(@(varargin)vertcat(varargin{:}),frameTSS1,frameTSS2,’UniformOutput’,false);
%% Name the Frame
% bottom special segment (BSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
jointBSSnew1{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(1)),:),2);
jointBSSnew2{i,:} = sortrows(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}(ismember(jointbottomspecialsegment.("Joint Bottom Special Segment"){i,1}.Z,Zbottombeam{i}(2)),:),2);
jointBSSnew{i,:} = vertcat(jointBSSnew1{i},jointBSSnew2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew1{i,1})-1
jointI(j) = jointBSSnew1{i,1}.ID(j);
jointJ(j) = jointBSSnew1{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameTSS{i,1}.("Frame ID"));
frameBSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(jointBSSnew2{i,1})-1
jointI(j) = jointBSSnew2{i,1}.ID(j);
jointJ(j) = jointBSSnew2{i,1}.ID(j+1);
end
lastframenumber{i,:} = max(frameBSS1{i,1}.("Frame ID"));
frameBSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameBSS = cellfun(@(varargin)vertcat(varargin{:}),frameBSS1,frameBSS2,’UniformOutput’,false);
%% Name the Frame
% diagonal ordinary segment (DOS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tosleft{i,:} = frameTOS{i,1}(1:2:end,:);
tosright{i,:} = frameTOS{i,1}(2:2:end,:);
bosleft{i,:} = frameBOS{i,1}(1:2:end,:);
bosright{i,:} = frameBOS{i,1}(2:2:end,:);
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tosleft{i,1})
jointI(j) = tosleft{i,1}.JointI(j);
jointJ(j) = bosleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameBSS{i,1}.("Frame ID"));
frameDOS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bosright{i,1})
jointI(j) = bosright{i,1}.JointI(j);
jointJ(j) = tosright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS1{i,1}.("Frame ID"));
frameDOS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDOS = cellfun(@(varargin)vertcat(varargin{:}),frameDOS1,frameDOS2,’UniformOutput’,false);
%% Name the Frame
% diagonal special segment (DSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
tssright{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
bssright{i,:} = frameBSS{i,1};
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDOS{i,1}.("Frame ID"));
frameDSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(bssright{i,1})
jointI(j) = bssright{i,1}.JointI(j);
jointJ(j) = tssright{i,1}.JointJ(j);
end
lastframenumber{i,:} = max(frameDSS1{i,1}.("Frame ID"));
frameDSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameDSS = cellfun(@(varargin)vertcat(varargin{:}),frameDSS1,frameDSS2,’UniformOutput’,false);
%% Name the Frame
% vertical special segment (VSS) (this phase is not automatic for different story)
for i = 1:height(VariantIDPassed)
tssleft{i,:} = frameTSS{i,1};
bssleft{i,:} = frameBSS{i,1};
endtss1{i,:} = max(jointTSSnew1{i,1}.ID);
endtss2{i,:} = max(jointTSSnew2{i,1}.ID);
endbss1{i,:} = max(jointBSSnew1{i,1}.ID);
endbss2{i,:} = max(jointBSSnew2{i,1}.ID);
endtss{i,:} = vertcat(endtss1{i},endtss2{i});
endbss{i,:} = vertcat(endbss1{i},endbss2{i});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:height(tssleft{i,1})
jointI(j) = tssleft{i,1}.JointI(j);
jointJ(j) = bssleft{i,1}.JointI(j);
end
lastframenumber{i,:} = max(frameDSS{i,1}.("Frame ID"));
frameVSS1{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
for i = 1:height(VariantIDPassed)
jointI = 0;
jointJ = 0;
for j = 1:NumberStory
jointI(j) = endtss{i,:}(j);
jointJ(j) = endbss{i,:}(j);
end
lastframenumber{i,:} = max(frameVSS1{i,1}.("Frame ID"));
frameVSS2{i,:} = table((lastframenumber{i}+1:lastframenumber{i}+j)’,jointI’,jointJ’,’VariableNames’,{‘Frame ID’,’JointI’,’JointJ’});
end
frameVSS = cellfun(@(varargin)vertcat(varargin{:}),frameVSS1,frameVSS2,’UniformOutput’,false);
%% Print ‘frame’ data to textline
txtframeCOLUMN = strings(height(framecolumn),1);
for i = 1:height(framecolumn)
T = framecolumn{i};
M = T{:,:};
txtframeCOLUMN(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTOS = strings(height(frameTOS),1);
for i = 1:height(frameTOS)
T = frameTOS{i};
M = T{:,:};
txtframeTOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBOS = strings(height(frameBOS),1);
for i = 1:height(frameBOS)
T = frameBOS{i};
M = T{:,:};
txtframeBOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeTSS = strings(height(frameTSS),1);
for i = 1:height(frameTSS)
T = frameTSS{i};
M = T{:,:};
txtframeTSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeBSS = strings(height(frameBSS),1);
for i = 1:height(frameBSS)
T = frameBSS{i};
M = T{:,:};
txtframeBSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDOS = strings(height(frameDOS),1);
for i = 1:height(frameDOS)
T = frameDOS{i};
M = T{:,:};
txtframeDOS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeDSS = strings(height(frameDSS),1);
for i = 1:height(frameDSS)
T = frameDSS{i};
M = T{:,:};
txtframeDSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
txtframeVSS = strings(height(frameVSS),1);
for i = 1:height(frameVSS)
T = frameVSS{i};
M = T{:,:};
txtframeVSS(i) = sprintf(" Frame=%d JointI=%d JointJ=%d IsCurved=No n",M.’);
end
%% Print ‘joint’ data to textline
txtjointBASE = strings(height(jointbase),1);
for i = 1:height(jointbase)
T = jointbase.("Joint Base"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBASE(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointCOLUMN = strings(height(jointcolumn),1);
for i = 1:height(jointcolumn)
T = jointcolumn.("Joint Column"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointCOLUMN(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTOS = strings(height(jointtopordinarysegment),1);
for i = 1:height(jointtopordinarysegment)
T = jointtopordinarysegment.("Joint Top Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBOS = strings(height(jointbottomordinarysegment),1);
for i = 1:height(jointbottomordinarysegment)
T = jointbottomordinarysegment.("Joint Bottom Ordinary Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBOS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointTSS = strings(height(jointtopspecialsegment),1);
for i = 1:height(jointtopspecialsegment)
T = jointtopspecialsegment.("Joint Top Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointTSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
txtjointBSS = strings(height(jointbottomspecialsegment),1);
for i = 1:height(jointbottomspecialsegment)
T = jointbottomspecialsegment.("Joint Bottom Special Segment"){i};
M = T{:,:};
M(:,end+[1 2]) = M(:,[2 3]); % duplicate columns 2 and 3 into columns 4 and 5
txtjointBSS(i) = sprintf(" Joint=%d CoordSys=GLOBAL CoordType=Cartesian XorR=%1.3f Y=0 Z=%1.3f SpecialJt=No GlobalX=%1.3f GlobalY=0 GlobalZ=%1.3fn",M.’);
end
%% WRITE s2k Extension Files
VariantModel = compose(‘%d’, 1:height(VariantIDPassed));
lined= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
for i = 1:numel(VariantModel)
writefile(VariantModel{i},txtjointBASE{i},txtjointCOLUMN{i},txtjointTOS{i},txtjointBOS{i},txtjointTSS{i},txtjointBSS{i},txtframeCOLUMN{i},txtframeTOS{i},txtframeBOS{i},txtframeTSS{i},txtframeBSS{i},txtframeDOS{i},txtframeDSS{i},txtframeVSS{i});
end
files = dir(‘*.s2k’);
files(:).name;
function writefile(C,txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS,txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS)
fido = fopen("ModelVariant"+C+".s2k",’wt’);
newline = ‘n’;
line1=’File D:\MAGISTER\KULIAH\TESIS\S2K FILE\ModelVariant-%d.s2k was saved on m/d/yy at h:mm:ss’;
line2=’TABLE: "PROGRAM CONTROL"’;
line3=’ ProgramName=SAP2000 Version=25.0.0 ProgLevel=Ultimate LicenseNum=3010*1D6KZBK478DMQCT LicenseOS=Yes LicenseSC=Yes LicenseHT=No CurrUnits="KN, m, C" SteelCode="AISC 360-10" ConcCode="ACI 318-19" AlumCode="AA 2015" _’;
line4=’ ColdCode=AISI-16 RegenHinge=Yes’;
line5=’TABLE: "ACTIVE DEGREES OF FREEDOM"’;
line6=’ UX=Yes UY=No UZ=Yes RX=No RY=Yes RZ=No’;
line7=’TABLE: "ANALYSIS OPTIONS"’;
line8=’ Solver=Multithreaded SolverProc="Analysis Process" NumParallel=0 Force32Bit=No StiffCase=None GeomMod=None HingeOpt="In Elements" NumAThreads=0 MaxFileSize=0 NumDThreads=0 NumRThreads=0 _ UseMMFiles="Program Determined" AllowDiff=No’;
line9=’TABLE: "COORDINATE SYSTEMS"’;
line10=’ Name=GLOBAL Type=Cartesian X=0 Y=0 Z=0 AboutZ=0 AboutY=0 AboutX=0′;
line11=’TABLE: "GRID LINES"’;
line12=’ CoordSys=GLOBAL AxisDir=X GridID=A XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End AllVisible=Yes BubbleSize=1,5′;
line13=’ CoordSys=GLOBAL AxisDir=X GridID=B XRYZCoord=15 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line14=’ CoordSys=GLOBAL AxisDir=X GridID=C XRYZCoord=30 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line15=’ CoordSys=GLOBAL AxisDir=Y GridID=1 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=Start’;
line16=’ CoordSys=GLOBAL AxisDir=Z GridID=Z0 XRYZCoord=0 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line17=’ CoordSys=GLOBAL AxisDir=Z GridID=Z1 XRYZCoord=5 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line18=’ CoordSys=GLOBAL AxisDir=Z GridID=Z2 XRYZCoord=10 LineType=Primary LineColor=Gray8Dark Visible=Yes BubbleLoc=End’;
line19=’TABLE: "MATERIAL PROPERTIES 01 – GENERAL"’;
line20=’ Material=4000Psi Type=Concrete Grade="’ + "f’c 4000 " + ‘psi"’+ ‘ SymType=Isotropic TempDepend=No Color=Green GUID=b0920fc0-a39b-46e4-a096-037f0f0739a7 Notes="Customary ‘+"f’c 4000 psi "+’01/02/2024 20:13:33"’;
line21=’ Material=BJ-37 Type=Steel Grade="Grade 50" SymType=Isotropic TempDepend=No Color=Magenta Notes="ASTM A992 Grade 50 01/02/2024 20:03:34"’;
line22=’TABLE: "MATERIAL PROPERTIES 02 – BASIC MECHANICAL PROPERTIES"’;
line23=’ Material=4000Psi UnitWeight=23,5631216161854 UnitMass=2,40276960558926 E1=24855578,0600518 G12=10356490,8583549 U12=0,2 A1=9,89999952793124E-06′;
line24=’ Material=BJ-37 UnitWeight=76,9728639422648 UnitMass=7,84904737995992 E1=199947978,795958 G12=76903068,7676762 U12=0,3 A1=1,16999994421006E-05′;
line25=’TABLE: "MATERIAL PROPERTIES 03A – STEEL DATA"’;
line26=’ Material=BJ-37 Fy=235000 Fu=352500 EffFy=235000 EffFu=352500 SSCurveOpt=Simple SSHysType=Kinematic SHard=0,015 SMax=0,11 SRup=0,17 FinalSlope=-0,1 CoupModType="Von Mises"’;
line27=’TABLE: "MATERIAL PROPERTIES 06 – DAMPING PARAMETERS"’;
line28=’ Material=4000Psi ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line29=’ Material=BJ-37 ModalRatio=0 VisMass=0 VisStiff=0 HysMass=0 HysStiff=0′;
line30=’TABLE: "MATERIAL PROPERTIES 09 – ACCEPTANCE CRITERIA"’;
line31=’ Material=4000Psi IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,003 LSComp=-0,006 CPComp=-0,015 IgnoreTens=Yes’;
line32=’ Material=BJ-37 IOTens=0,01 LSTens=0,02 CPTens=0,05 IOComp=-0,005 LSComp=-0,01 CPComp=-0,02′;
line33=’TABLE: "FRAME SECTION PROPERTIES 01 – GENERAL"’;
line34=’ SectionName=ExampleWideFlanged Material=BJ-37 Shape="I/Wide Flange" t3=0,25 t2=0,15 tf=0,012 tw=0,008 t2b=0,15 tfb=0,012 FilletRadius=0,012 Area=0,005552 TorsConst=2,13418666666667E-07 I33=6,04638656154112E-05 _’;
line35=’ I22=6,76749435145855E-06 I23=-6,7762635780344E-21 AS2=0,00200790111881035 AS3=0,00357344416053972 S33Top=0,00048371092492329 S33Bot=0,00048371092492329 S22Left=9,02332580194473E-05 S22Right=9,02332580194473E-05 _’;
line36=’ Z33=0,000546402338734841 Z22=0,00013961366126516 R33=0,10435739412628 R22=0,0349131651083826 CGOffset3=-1,38777878078145E-17 CGOffset2=5,55111512312578E-17 EccV2=0 EccV3=0 Cw=9,558675E-08 ConcCol=No ConcBeam=No _’;
line37=’ Color=Blue TotalWt=60,3707599671425 TotalMass=6,15610399662034 FromFile=No AMod=1 A2Mod=1 A3Mod=1 JMod=1 I2Mod=1 I3Mod=1 MMod=1 WMod=1 Notes="Added 03/04/2024 20:08:55′;
line38=’TABLE: "LOAD PATTERN DEFINITIONS"’;
line39=’ LoadPat=DEAD DesignType=Dead SelfWtMult=1 GUID=d2c74fc0-a771-416d-b3dc-4b0a2047268d’;
line40=’ LoadPat=SUPERDEAD DesignType="Super Dead" SelfWtMult=0 GUID=91534b51-672f-4fb0-a037-d7225de00c69 Notes="Added 01/02/2024 20:08:11"’;
line41=’ LoadPat=LIVE DesignType=Live SelfWtMult=0 GUID=1f6f6fd1-e0f1-4fcb-bf3d-dc86bd53f1a8 Notes="Added 01/02/2024 20:08:16"’;
line42=’TABLE: "GROUPS 1 – DEFINITIONS"’;
line43=’ GroupName=All Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line44=’ GroupName=ST_Top Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line45=’ GroupName=ST_Bot Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line46=’ GroupName=ST_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line47=’ GroupName=ST_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line48=’ GroupName=OT_Top1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line49=’ GroupName=OT_Top2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Yellow’;
line49a=’ GroupName=OT_Bot1 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Gray8Dark’;
line49b=’ GroupName=OT_Bot2 Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Blue’;
line49c=’ GroupName=OT_Ver Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Green’;
line49d=’ GroupName=OT_Diag Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Cyan’;
line49e=’ GroupName=Column_End Selection=Yes SectionCut=Yes Steel=Yes Concrete=Yes Aluminum=Yes ColdFormed=Yes Stage=Yes Bridge=Yes AutoSeismic=No AutoWind=No SelDesSteel=No SelDesAlum=No SelDesCold=No MassWeight=Yes Color=Red’;
line50=’TABLE: "JOINT PATTERN DEFINITIONS"’;
line51=’ Pattern=Default’;
line52=’TABLE: "MASS SOURCE"’;
line53=’ MassSource=MSSSRC1 Elements=Yes Masses=Yes Loads=Yes IsDefault=Yes LoadPat=DEAD Multiplier=1′;
line54=’ MassSource=MSSSRC1 LoadPat=SUPERDEAD Multiplier=1′;
line55=’ MassSource=MSSSRC1 LoadPat=LIVE Multiplier=0,5′;
line56=’TABLE: "LOAD CASE DEFINITIONS"’;
line57=’ Case=DEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=91b91585-f6e6-446e-ac30-362013fd8af9′;
line58=’ Case=MODAL Type=LinModal InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Other DesActOpt="Prog Det" DesignAct=Other AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=3e160405-efbf-45fb-ae06-c6da634ca183′;
line59=’ Case=SUPERDEAD Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType="Super Dead" DesActOpt="Prog Det" DesignAct="Long-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=2ca565b7-af73-42e9-9208-0a0739594699′;
line60=’ Case=LIVE Type=LinStatic InitialCond=Zero DesTypeOpt="Prog Det" DesignType=Live DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e969dd8f-56cc-40d7-af8a-0fba39157fcb’;
line61=’ Case="Gravity NLS" Type=NonStatic InitialCond=Zero MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Dead DesActOpt="Prog Det" DesignAct=Non-Composite AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line62=’ Case=Pushover-UX Type=NonStatic InitialCond="Gravity NLS" MassSource=MSSSRC1 DesTypeOpt="Prog Det" DesignType=Quake DesActOpt="Prog Det" DesignAct="Short-Term Composite" AutoType=None RunCase=Yes CaseStatus="Not Run" GUID=e13dc273-9465-4be3-a170-d60ddec6e3ae’;
line63=’TABLE: "CASE – STATIC 1 – LOAD ASSIGNMENTS"’;
line64=’ Case=DEAD LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line65=’ Case=SUPERDEAD LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line66=’ Case=LIVE LoadType="Load pattern" LoadName=LIVE LoadSF=1′;
line67=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=DEAD LoadSF=1′;
line68=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=SUPERDEAD LoadSF=1′;
line69=’ Case="Gravity NLS" LoadType="Load pattern" LoadName=LIVE LoadSF=0,5′;
line70=’ Case=Pushover-UX LoadType=Accel LoadName="Accel UX" TransAccSF=-1′;
line71=’TABLE: "CASE – STATIC 2 – NONLINEAR LOAD APPLICATION"’;
line72=’ Case="Gravity NLS" LoadApp="Full Load" MonitorDOF=U1 MonitorJt=9′;
line73=’ Case=Pushover-UX LoadApp="Displ Ctrl" DisplType=Monitored TargetDispl=1 MonitorDOF=U1 MonitorJt=9′;
line74=’TABLE: "CASE – STATIC 4 – NONLINEAR PARAMETERS"’;
line75=’ Case="Gravity NLS" GeoNonLin=P-Delta ResultsSave="Final State" SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 _’;
line76=’ TFAccelFact=1 TFNoStop=No’;
line77=’ Case=Pushover-UX GeoNonLin=P-Delta ResultsSave="Multiple States" MinNumState=10 MaxNumState=100 PosIncOnly=Yes SolScheme="Iterative Events" MaxTotal=200 MaxNull=50 EvLumpTol=0,01 MaxEvPerStp=24 MaxIterCS=10 _’;
line78=’ MaxIterNR=40 ItConvTol=0,0001 TFMaxIter=10 TFTol=0,01 TFAccelFact=1 TFNoStop=No’;
line79=’TABLE: "CASE – MODAL 1 – GENERAL"’;
line80=’ Case=MODAL ModeType=Eigen MaxNumModes=12 MinNumModes=1 EigenShift=0 EigenCutoff=0 EigenTol=1E-09 AutoShift=Yes’;
line81=’TABLE: "JOINT COORDINATES"’;
line82= append(txtjointBASE,txtjointCOLUMN,txtjointTOS,txtjointBOS,txtjointTSS,txtjointBSS);
line83=’TABLE: "CONNECTIVITY – FRAME"’;
line84= append(txtframeCOLUMN,txtframeTOS,txtframeBOS,txtframeTSS,txtframeBSS,txtframeDOS,txtframeDSS,txtframeVSS);
line85=’TABLE: "END TABLE DATA"’;
combine1 = append(line1,newline,line2,newline,line3,newline,line4,newline,line5,newline,line6,newline,line7,newline,line8,newline,line9,newline,line10,newline,line11,newline,line12,newline,line13,newline,line14,newline,line15,newline,line16,newline,line17,newline,line18,newline,line19,newline,line20,newline,line21,newline,line22,newline,line23,newline,line24,newline,line25,newline,line26,newline,line27,newline,line28,newline,line29,newline,line30,newline,line31,newline,line32,newline,line33,newline,line34,newline,line35,newline,line36);
combine2 = append(combine1,newline,line37,newline,line38,newline,line39,newline,line40,newline,line41,newline,line42,newline,line43,newline,line44,newline,line45,newline,line46,newline,line47,newline,line48,newline,line49,newline,line49a,newline,line49b,newline,line49c,newline,line49d,newline,line49e,newline,line50,newline,line51,newline,line52,newline,line53,newline,line54,newline,line55,newline,line56,newline,line57,newline,line58,newline,line59,newline,line60,newline,line61,newline,line62,newline,line63,newline,line64,newline,line65,newline,line66,newline,line67,newline,line68,newline);
combine3 = append(combine2,line69,newline,line70,newline,line71,newline,line72,newline,line73,newline,line74,newline,line75,newline,line76,newline,line77,newline,line78,newline,line79,newline,line80,newline,line81,newline,line82,newline,line83,newline,line84,newline,line85);
fprintf(fido,combine3,C);
fclose(fido);
end
and second problem is why the result inside the file is different between when i Run the matlab by stepping (not single-run) and when i do one time running. When i do stepping-run one-by one the result is same with what my ittention. Because each file doesnt do double writing (just end in line no.85 (END TABLE DATA). The result will be like this:
But when i do one-time running it happened like this :
then how to stop double writing like that ? writefile, sprintf, text file, txt MATLAB Answers — New Questions
Unable to plot all lines on the same graph
I have written my equations with no error messages, and for some reason when it comes to plotting the graph I am only able to plot a couple of the lines ( when the code is ran).
% Constants
% ceiling
R1 = 0.01126172832; % Value of resistance R1
R2 = 0.3449615264; % Value of resistance R2
R3 = 3.642793719*10^-6; % Value of resistance R3
C1 = 54551.538; % Value of capacitance C1
C2 = 14220.95348; % Value of capacitance C2
C3 = 25734.0951; % Value of capacitance C3
Q_ceiling = 131.6056667;
%floor
R4 = 0.01070907326; % Value of resistance R4
R5 = 0.1640164882; % Value of resistance R5
R6 = 3.464028232*10^-6; % Value of resistance R6
C4 = 57366.738; % Value of capacitance C4
C5 = 7477.421738; % Value of capacitance C5
C6 = 27062.1351; % Value of capacitance C6
Q_floor = 138.3973924; % Value of Q
% wall with window
R7 = 0.0104376743; % Value of resistance R7
R8 = 0.3197196698; % Value of resistance R8
R9 = 3.376239713*10^-6; % Value of resistance R9
C7 = 58858.38; % Value of capacitance C7
C8 = 15343.69725; % Value of capacitance C8
C9 = 27765.801; % Value of capacitance C9
Q_windowwall = 141.9970071; % Value of Qwindowwall
%sidewall
R10 = 9.367616659*10^-3; % Value of resistance R10
R11 = 0.2869423992; % Value of resistance R11
R12 = 3.030111735*10^-6; % Value of resistance R12
C10 = 65581.74; % Value of capacitance C10
C11 = 17096.39925; % Value of capacitance C11
C12 = 30937.473; % Value of capacitance C12
Q_sidewall = 158.2172462; % Value of Qsidewall
% BH
R13 = 0.01992037022; % Value of resistance R13
R14 = 0.610187098 ; % Value of resistance R14
R15 = 0.01610893939; % Value of resistance R15
C13 = 30840.0192; % Value of capacitance C13
C14 = 8039.63544; % Value of capacitance C14
C15 = 15686.66403; % Value of capacitance C15
Q_BH = 74.0135789; % Value of QBH
% REAR DOORS
R16 = 0.02676244689; % Value of resistance R16
R17 = 0.8197688908; % Value of resistance R17
R18 = 8.656759486*10^-6; % Value of resistance R18
C16 = 22955.472; % Value of capacitance C16
C17 = 5984.2254; % Value of capacitance C17
C18 = 10828.9944; % Value of capacitance C18
Q_doors = 55.38053069; % Value of QDOORS
% Time vector for a 2-hour period (in seconds)
t = 0:0.01:2 *3600;
% Calculation of ∆T1_ceiling
deltaT1_ceiling = R1*Q_ceiling*(1 – exp(-1/(R1*C1)*t)) + R2*Q_ceiling*(1 – exp(-1/(R2*C2)*t)) + R3*Q_ceiling*(1 – exp(-1/(R3*C3)*t));
% Calculation of ∆T1_floor
deltaT1_floor= R4*Q_floor*(1 – exp(-1/(R4*C4)*t)) + R5*Q_floor*(1 – exp(-1/(R5*C5)*t)) + R6*Q_windowwall*(1 – exp(-1/(R6*C6)*t));
% Calculation of ∆T1_windowwall
deltaT1_windowwall= R7*Q_windowwall*(1 – exp(-1/(R7*C7)*t)) + R8*Q_windowwall*(1 – exp(-1/(R8*C8)*t)) + R9*Q_windowwall*(1 – exp(-1/(R9*C9)*t));
%Calculation of ∆T1_sidewall
deltaT1_sidewall= R10*Q_sidewall*(1 – exp(-1/(R10*C10)*t)) + R11*Q_sidewall*(1 – exp(-1/(R11*C11)*t)) + R12*Q_sidewall*(1 – exp(-1/(R12*C12)*t));
%Calculation of ∆T1_BH
deltaT1_BH= R13*Q_BH*(1 – exp(-1/(R13*C13)*t)) + R14*Q_BH*(1 – exp(-1/(R14*C14)*t)) + R15*Q_BH*(1 – exp(-1/(R15*C15)*t));
% Calculation of ∆T1_DOORS
deltaT1_doors= R16*Q_doors*(1 – exp(-1/(R16*C16)*t)) + R17*Q_doors*(1 – exp(-1/(R17*C17)*t)) + R18*Q_doors*(1 – exp(-1/(R18*C18)*t));
% Convert time to hours for plotting
t_hours = t / 3600; % Convert time from seconds to hours
%plotting
plot(t_hours, deltaT1_ceiling);
hold on;
plot(t_hours, deltaT1_sidewall);
plot(t_hours, deltaT1_doors);
plot(t_hours, deltaT1_BH);
plot(t_hours, deltaT1_windowwall);
plot(t_hours, deltaT1_floor);
hold off;I have written my equations with no error messages, and for some reason when it comes to plotting the graph I am only able to plot a couple of the lines ( when the code is ran).
% Constants
% ceiling
R1 = 0.01126172832; % Value of resistance R1
R2 = 0.3449615264; % Value of resistance R2
R3 = 3.642793719*10^-6; % Value of resistance R3
C1 = 54551.538; % Value of capacitance C1
C2 = 14220.95348; % Value of capacitance C2
C3 = 25734.0951; % Value of capacitance C3
Q_ceiling = 131.6056667;
%floor
R4 = 0.01070907326; % Value of resistance R4
R5 = 0.1640164882; % Value of resistance R5
R6 = 3.464028232*10^-6; % Value of resistance R6
C4 = 57366.738; % Value of capacitance C4
C5 = 7477.421738; % Value of capacitance C5
C6 = 27062.1351; % Value of capacitance C6
Q_floor = 138.3973924; % Value of Q
% wall with window
R7 = 0.0104376743; % Value of resistance R7
R8 = 0.3197196698; % Value of resistance R8
R9 = 3.376239713*10^-6; % Value of resistance R9
C7 = 58858.38; % Value of capacitance C7
C8 = 15343.69725; % Value of capacitance C8
C9 = 27765.801; % Value of capacitance C9
Q_windowwall = 141.9970071; % Value of Qwindowwall
%sidewall
R10 = 9.367616659*10^-3; % Value of resistance R10
R11 = 0.2869423992; % Value of resistance R11
R12 = 3.030111735*10^-6; % Value of resistance R12
C10 = 65581.74; % Value of capacitance C10
C11 = 17096.39925; % Value of capacitance C11
C12 = 30937.473; % Value of capacitance C12
Q_sidewall = 158.2172462; % Value of Qsidewall
% BH
R13 = 0.01992037022; % Value of resistance R13
R14 = 0.610187098 ; % Value of resistance R14
R15 = 0.01610893939; % Value of resistance R15
C13 = 30840.0192; % Value of capacitance C13
C14 = 8039.63544; % Value of capacitance C14
C15 = 15686.66403; % Value of capacitance C15
Q_BH = 74.0135789; % Value of QBH
% REAR DOORS
R16 = 0.02676244689; % Value of resistance R16
R17 = 0.8197688908; % Value of resistance R17
R18 = 8.656759486*10^-6; % Value of resistance R18
C16 = 22955.472; % Value of capacitance C16
C17 = 5984.2254; % Value of capacitance C17
C18 = 10828.9944; % Value of capacitance C18
Q_doors = 55.38053069; % Value of QDOORS
% Time vector for a 2-hour period (in seconds)
t = 0:0.01:2 *3600;
% Calculation of ∆T1_ceiling
deltaT1_ceiling = R1*Q_ceiling*(1 – exp(-1/(R1*C1)*t)) + R2*Q_ceiling*(1 – exp(-1/(R2*C2)*t)) + R3*Q_ceiling*(1 – exp(-1/(R3*C3)*t));
% Calculation of ∆T1_floor
deltaT1_floor= R4*Q_floor*(1 – exp(-1/(R4*C4)*t)) + R5*Q_floor*(1 – exp(-1/(R5*C5)*t)) + R6*Q_windowwall*(1 – exp(-1/(R6*C6)*t));
% Calculation of ∆T1_windowwall
deltaT1_windowwall= R7*Q_windowwall*(1 – exp(-1/(R7*C7)*t)) + R8*Q_windowwall*(1 – exp(-1/(R8*C8)*t)) + R9*Q_windowwall*(1 – exp(-1/(R9*C9)*t));
%Calculation of ∆T1_sidewall
deltaT1_sidewall= R10*Q_sidewall*(1 – exp(-1/(R10*C10)*t)) + R11*Q_sidewall*(1 – exp(-1/(R11*C11)*t)) + R12*Q_sidewall*(1 – exp(-1/(R12*C12)*t));
%Calculation of ∆T1_BH
deltaT1_BH= R13*Q_BH*(1 – exp(-1/(R13*C13)*t)) + R14*Q_BH*(1 – exp(-1/(R14*C14)*t)) + R15*Q_BH*(1 – exp(-1/(R15*C15)*t));
% Calculation of ∆T1_DOORS
deltaT1_doors= R16*Q_doors*(1 – exp(-1/(R16*C16)*t)) + R17*Q_doors*(1 – exp(-1/(R17*C17)*t)) + R18*Q_doors*(1 – exp(-1/(R18*C18)*t));
% Convert time to hours for plotting
t_hours = t / 3600; % Convert time from seconds to hours
%plotting
plot(t_hours, deltaT1_ceiling);
hold on;
plot(t_hours, deltaT1_sidewall);
plot(t_hours, deltaT1_doors);
plot(t_hours, deltaT1_BH);
plot(t_hours, deltaT1_windowwall);
plot(t_hours, deltaT1_floor);
hold off; I have written my equations with no error messages, and for some reason when it comes to plotting the graph I am only able to plot a couple of the lines ( when the code is ran).
% Constants
% ceiling
R1 = 0.01126172832; % Value of resistance R1
R2 = 0.3449615264; % Value of resistance R2
R3 = 3.642793719*10^-6; % Value of resistance R3
C1 = 54551.538; % Value of capacitance C1
C2 = 14220.95348; % Value of capacitance C2
C3 = 25734.0951; % Value of capacitance C3
Q_ceiling = 131.6056667;
%floor
R4 = 0.01070907326; % Value of resistance R4
R5 = 0.1640164882; % Value of resistance R5
R6 = 3.464028232*10^-6; % Value of resistance R6
C4 = 57366.738; % Value of capacitance C4
C5 = 7477.421738; % Value of capacitance C5
C6 = 27062.1351; % Value of capacitance C6
Q_floor = 138.3973924; % Value of Q
% wall with window
R7 = 0.0104376743; % Value of resistance R7
R8 = 0.3197196698; % Value of resistance R8
R9 = 3.376239713*10^-6; % Value of resistance R9
C7 = 58858.38; % Value of capacitance C7
C8 = 15343.69725; % Value of capacitance C8
C9 = 27765.801; % Value of capacitance C9
Q_windowwall = 141.9970071; % Value of Qwindowwall
%sidewall
R10 = 9.367616659*10^-3; % Value of resistance R10
R11 = 0.2869423992; % Value of resistance R11
R12 = 3.030111735*10^-6; % Value of resistance R12
C10 = 65581.74; % Value of capacitance C10
C11 = 17096.39925; % Value of capacitance C11
C12 = 30937.473; % Value of capacitance C12
Q_sidewall = 158.2172462; % Value of Qsidewall
% BH
R13 = 0.01992037022; % Value of resistance R13
R14 = 0.610187098 ; % Value of resistance R14
R15 = 0.01610893939; % Value of resistance R15
C13 = 30840.0192; % Value of capacitance C13
C14 = 8039.63544; % Value of capacitance C14
C15 = 15686.66403; % Value of capacitance C15
Q_BH = 74.0135789; % Value of QBH
% REAR DOORS
R16 = 0.02676244689; % Value of resistance R16
R17 = 0.8197688908; % Value of resistance R17
R18 = 8.656759486*10^-6; % Value of resistance R18
C16 = 22955.472; % Value of capacitance C16
C17 = 5984.2254; % Value of capacitance C17
C18 = 10828.9944; % Value of capacitance C18
Q_doors = 55.38053069; % Value of QDOORS
% Time vector for a 2-hour period (in seconds)
t = 0:0.01:2 *3600;
% Calculation of ∆T1_ceiling
deltaT1_ceiling = R1*Q_ceiling*(1 – exp(-1/(R1*C1)*t)) + R2*Q_ceiling*(1 – exp(-1/(R2*C2)*t)) + R3*Q_ceiling*(1 – exp(-1/(R3*C3)*t));
% Calculation of ∆T1_floor
deltaT1_floor= R4*Q_floor*(1 – exp(-1/(R4*C4)*t)) + R5*Q_floor*(1 – exp(-1/(R5*C5)*t)) + R6*Q_windowwall*(1 – exp(-1/(R6*C6)*t));
% Calculation of ∆T1_windowwall
deltaT1_windowwall= R7*Q_windowwall*(1 – exp(-1/(R7*C7)*t)) + R8*Q_windowwall*(1 – exp(-1/(R8*C8)*t)) + R9*Q_windowwall*(1 – exp(-1/(R9*C9)*t));
%Calculation of ∆T1_sidewall
deltaT1_sidewall= R10*Q_sidewall*(1 – exp(-1/(R10*C10)*t)) + R11*Q_sidewall*(1 – exp(-1/(R11*C11)*t)) + R12*Q_sidewall*(1 – exp(-1/(R12*C12)*t));
%Calculation of ∆T1_BH
deltaT1_BH= R13*Q_BH*(1 – exp(-1/(R13*C13)*t)) + R14*Q_BH*(1 – exp(-1/(R14*C14)*t)) + R15*Q_BH*(1 – exp(-1/(R15*C15)*t));
% Calculation of ∆T1_DOORS
deltaT1_doors= R16*Q_doors*(1 – exp(-1/(R16*C16)*t)) + R17*Q_doors*(1 – exp(-1/(R17*C17)*t)) + R18*Q_doors*(1 – exp(-1/(R18*C18)*t));
% Convert time to hours for plotting
t_hours = t / 3600; % Convert time from seconds to hours
%plotting
plot(t_hours, deltaT1_ceiling);
hold on;
plot(t_hours, deltaT1_sidewall);
plot(t_hours, deltaT1_doors);
plot(t_hours, deltaT1_BH);
plot(t_hours, deltaT1_windowwall);
plot(t_hours, deltaT1_floor);
hold off; graph, plot MATLAB Answers — New Questions
How to change methods access to public in App Designer
Hello, I’m currrently creating an app in App Designer MATLAB. I’m trying to change the header names of a table that is being read in. There are 27 columns so my approach is to read in a MAT file with the header names. App Designer is making it difficult to load the file. I saw an example where the method was switched to public instead of private to make it accessible. How is this possible? The area is grayed out and I’m unsure how to switch it to public.Hello, I’m currrently creating an app in App Designer MATLAB. I’m trying to change the header names of a table that is being read in. There are 27 columns so my approach is to read in a MAT file with the header names. App Designer is making it difficult to load the file. I saw an example where the method was switched to public instead of private to make it accessible. How is this possible? The area is grayed out and I’m unsure how to switch it to public. Hello, I’m currrently creating an app in App Designer MATLAB. I’m trying to change the header names of a table that is being read in. There are 27 columns so my approach is to read in a MAT file with the header names. App Designer is making it difficult to load the file. I saw an example where the method was switched to public instead of private to make it accessible. How is this possible? The area is grayed out and I’m unsure how to switch it to public. appdesigner, load mat MATLAB Answers — New Questions
What is the correct normalization for a flat top window?
Hi, I have a question about FFT. Considering that I have a data vector of accelerations sampled with an accelerometer and that I want to apply a flat top window, in order to obtain the most accurate amplitude in the FFT, what would be the right code for normalization in this specific case?
I tried this one, but I’m not sure if it’s correct:
N=numel(data);
w=flattopwin(N);
X=2*fft(data.*w)/sum(w);
Thanks in advance for you help.Hi, I have a question about FFT. Considering that I have a data vector of accelerations sampled with an accelerometer and that I want to apply a flat top window, in order to obtain the most accurate amplitude in the FFT, what would be the right code for normalization in this specific case?
I tried this one, but I’m not sure if it’s correct:
N=numel(data);
w=flattopwin(N);
X=2*fft(data.*w)/sum(w);
Thanks in advance for you help. Hi, I have a question about FFT. Considering that I have a data vector of accelerations sampled with an accelerometer and that I want to apply a flat top window, in order to obtain the most accurate amplitude in the FFT, what would be the right code for normalization in this specific case?
I tried this one, but I’m not sure if it’s correct:
N=numel(data);
w=flattopwin(N);
X=2*fft(data.*w)/sum(w);
Thanks in advance for you help. fft, signal processing MATLAB Answers — New Questions
Can classes or class variables be used in stateflow charts / test sequences
I’m creating a test sequence for a test harness and would like to use an object in the steps. However, I receive a message that Data type of ‘<initialized object variable name>’ is not supported in Stateflow charts. I know I can perform function calls, but I need some state maintenance to drive function behavior and would like to use an object’s methods instead of raw functions.
Is this possible?I’m creating a test sequence for a test harness and would like to use an object in the steps. However, I receive a message that Data type of ‘<initialized object variable name>’ is not supported in Stateflow charts. I know I can perform function calls, but I need some state maintenance to drive function behavior and would like to use an object’s methods instead of raw functions.
Is this possible? I’m creating a test sequence for a test harness and would like to use an object in the steps. However, I receive a message that Data type of ‘<initialized object variable name>’ is not supported in Stateflow charts. I know I can perform function calls, but I need some state maintenance to drive function behavior and would like to use an object’s methods instead of raw functions.
Is this possible? stateflow chart, object, test harness, test sequence, simulink MATLAB Answers — New Questions
Changing the shell for system commands to mingw-w64
Hi community,
I’ve been trying to use ‘system’ commands in MATLAB to execute operating system command (from MRtrix3 to be specific). However, to do so I need to change the shell from default to mingw-w64 for my windows laptop, which I’ve been struggling to do. While I’ve tryied things like:
setenv MATLAB_SHELL C:msys2mingw64.exe
inside my script before calling system comamnds, it doesn’t actually work.
I wonder what can I do about this / what i did wrong.
Many thanks in advanceHi community,
I’ve been trying to use ‘system’ commands in MATLAB to execute operating system command (from MRtrix3 to be specific). However, to do so I need to change the shell from default to mingw-w64 for my windows laptop, which I’ve been struggling to do. While I’ve tryied things like:
setenv MATLAB_SHELL C:msys2mingw64.exe
inside my script before calling system comamnds, it doesn’t actually work.
I wonder what can I do about this / what i did wrong.
Many thanks in advance Hi community,
I’ve been trying to use ‘system’ commands in MATLAB to execute operating system command (from MRtrix3 to be specific). However, to do so I need to change the shell from default to mingw-w64 for my windows laptop, which I’ve been struggling to do. While I’ve tryied things like:
setenv MATLAB_SHELL C:msys2mingw64.exe
inside my script before calling system comamnds, it doesn’t actually work.
I wonder what can I do about this / what i did wrong.
Many thanks in advance shell, system MATLAB Answers — New Questions
I’m having trouble seperating two body from phasing into one another
Hi, I’m a beginer at using simulink and matlab, and I have been having trouble seperating a quadcopter model from falling through my supposely ground surface block. I’ve have tried looking into the Simscape Multibody Contact Forces Library, but I do not find a solution there. Any ideas to resolve this issue would be appreciated? Thank you.Hi, I’m a beginer at using simulink and matlab, and I have been having trouble seperating a quadcopter model from falling through my supposely ground surface block. I’ve have tried looking into the Simscape Multibody Contact Forces Library, but I do not find a solution there. Any ideas to resolve this issue would be appreciated? Thank you. Hi, I’m a beginer at using simulink and matlab, and I have been having trouble seperating a quadcopter model from falling through my supposely ground surface block. I’ve have tried looking into the Simscape Multibody Contact Forces Library, but I do not find a solution there. Any ideas to resolve this issue would be appreciated? Thank you. simscape MATLAB Answers — New Questions
What is the difference between rcosdesign and fdesign.pulseshaping?
The <https://www.mathworks.com/help/signal/release-notes.html?searchHighlight=firrcos&s_tid=doc_srchtitle release notes on the Signal Processing Toolbox> say that firrcos and fdesign.pulseshaping are deprecated by rcosdesign, and a little bit farther it gives specific code for converting from fdesign.pulseshaping to rcosdesign. Specifically, it says:
n1n = rcosdesign(Beta,span,sps);
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is equivalent to:
sps = 6;
span = 4;
Beta = 0.25;
f1 = fdesign.pulseshaping(sps, …
‘Square Root Raised Cosine’, …
‘Nsym,Beta’,span,Beta);
d1 = design(f1);
n1 = d1.Numerator
which appears to be true. However, can anyone explain what the
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is doing? In other words, what is the difference between these two functions such that some connector code is needed to go from one to the other? From a rough understanding, it looks like it is normalizing the values, but then not really sure on the rest.The <https://www.mathworks.com/help/signal/release-notes.html?searchHighlight=firrcos&s_tid=doc_srchtitle release notes on the Signal Processing Toolbox> say that firrcos and fdesign.pulseshaping are deprecated by rcosdesign, and a little bit farther it gives specific code for converting from fdesign.pulseshaping to rcosdesign. Specifically, it says:
n1n = rcosdesign(Beta,span,sps);
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is equivalent to:
sps = 6;
span = 4;
Beta = 0.25;
f1 = fdesign.pulseshaping(sps, …
‘Square Root Raised Cosine’, …
‘Nsym,Beta’,span,Beta);
d1 = design(f1);
n1 = d1.Numerator
which appears to be true. However, can anyone explain what the
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is doing? In other words, what is the difference between these two functions such that some connector code is needed to go from one to the other? From a rough understanding, it looks like it is normalizing the values, but then not really sure on the rest. The <https://www.mathworks.com/help/signal/release-notes.html?searchHighlight=firrcos&s_tid=doc_srchtitle release notes on the Signal Processing Toolbox> say that firrcos and fdesign.pulseshaping are deprecated by rcosdesign, and a little bit farther it gives specific code for converting from fdesign.pulseshaping to rcosdesign. Specifically, it says:
n1n = rcosdesign(Beta,span,sps);
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is equivalent to:
sps = 6;
span = 4;
Beta = 0.25;
f1 = fdesign.pulseshaping(sps, …
‘Square Root Raised Cosine’, …
‘Nsym,Beta’,span,Beta);
d1 = design(f1);
n1 = d1.Numerator
which appears to be true. However, can anyone explain what the
n1n = n1n / max(n1n) * (-1/(pi*sps) …
* (pi*(Beta-1) – 4*Beta))
is doing? In other words, what is the difference between these two functions such that some connector code is needed to go from one to the other? From a rough understanding, it looks like it is normalizing the values, but then not really sure on the rest. fir, filter, dsp MATLAB Answers — New Questions