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

 채택된 답변

Image Analyst
Image Analyst 2015년 8월 4일

0 개 추천

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

CPdaCE
CPdaCE 2015년 8월 4일
I left an answer with the file attached. Thank you for your help.
Image Analyst
Image Analyst 2015년 8월 5일
I ran it several times. All times it produced 4 figures. It never failed to run.
CPdaCE
CPdaCE 2015년 8월 5일
Hmm. Weird. Well thanks for you help.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2015년 8월 4일

0 개 추천

In the line before
for i =1:3
change the hold on to hold off

댓글 수: 1

CPdaCE
CPdaCE 2015년 8월 4일
I tried doing that and it still will only run correctly after I clear all and close all in the command window. Thank you for the help.

댓글을 달려면 로그인하십시오.

CPdaCE
CPdaCE 2015년 8월 4일

0 개 추천

Thank you for the speedy response. Here is the file that I used to build the plots and what not. And I have not tried/heard of the debugger I will try it out. Also, changing hold off did not fix the problem. Let me know if you guys figure anything else out. Thank you again.

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2015년 8월 4일

댓글:

2015년 8월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by