Code won't run more then once correctly
2 views (last 30 days)
Show older comments
When I run the code provided, it works, then when I try to run it again it doesn't go all the way through, spits out data and doesn't create the plots desired. I can clear all, clc and then it runs correctly but it doesn't work again. Please provide feedback when you get the chance. Thank You.
%%Shear Beam - Analysis
clear all
close all
clc
set(0,'DefaulttextFontName','Times New Roman')
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize',12)
set(0,'DefaultTextFontSize',14)
addpath(genpath('J:/Research/Testing'))
load PS_0SR_192_72_NC_V_data.txt;
%%A. Data Location
data = PS_0SR_192_72_NC_V_data;
time = data(:,1);
mark = data(:,2);
SP1 = data(:,3)*-1;
SP2 = data(:,4)*-1;
SP3 = data(:,5)*-1;
Tilt0 = data(:,6);
Tilt1 = data(:,7);
PB = data(:,8);
T2 = {'SP1 - Quarter Point','SP2 - Midsan','SP3 - Quarter Point'};
SP = [SP1 SP2 SP3];
m1 = min(find(time==0));
m4 = max(find(time==2749.121715));
m2 = (find(time==1176.021716));
m3 = (find(time==1176.221715));
tm_fixed = [m1:m2 m3:m4];
%%B. Load vs Deflection
x = repmat((0:0.25:0.75),3,1);
plot(SP1(tm_fixed),PB(tm_fixed),'color',x(1:3,1))
hold on;
plot(SP2(tm_fixed),PB(tm_fixed),'color',x(1:3,3))
hold on;
plot(SP3(tm_fixed),PB(tm_fixed),'color',x(1:3,4))
axis([0 .2 0 100000])
grid
legend('QuaterPoint','Midspan','EndPoint','Location','southeast');
title('UHPC Load vs Deflection','fontsize',14)
xlabel('Deflection, in. (mm)')
ylabel('Load, kips (kN)')
hold on;
for i =1:3
figure;
co = [x(1:3,1) x(1:3,3) x(1:3,4)];
SPx=SP(:,i);
plot(SPx(tm_fixed),PB(tm_fixed),'color',co(:,i(1,1)))
hold on;
axis([0 .2 0 100000])
grid
legend(T2(1,i),'Location','SouthEast');
title('UHPC Load vs Deflection','fontsize',14)
xlabel('Deflection, in. (mm)')
ylabel('Load, kips (kN)')
hold on;
end
hold off
0 Comments
Accepted Answer
Image Analyst
on 4 Aug 2015
What do you learn when you step through it line by line in the debugger? I bet that would tell you what lines of code it's executing and let you know what the problem is. You didn't attach PS_0SR_192_72_NC_V_data.txt so we can't run your code to test it - you have to do that.
3 Comments
Image Analyst
on 5 Aug 2015
I ran it several times. All times it produced 4 figures. It never failed to run.
More Answers (2)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!