Code won't run more then once correctly
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 4 Août 2015
In the line before
for i =1:3
change the hold on to hold off
1 commentaire
CPdaCE
le 4 Août 2015
CPdaCE
le 4 Août 2015
0 votes
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!