Can You Implement a Rollback Feature in a MATLAB Program?

  • Context: MATLAB 
  • Thread starter Thread starter elbarto
  • Start date Start date
  • Tags Tags
    Frame Matlab Program
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 8K views
elbarto
Messages
32
Reaction score
0
Hi,
I have been working on a MATLAB program for solving the member forces in a 2d frame structure which many people have helped me out with on this forum. I have finally got the script to a point where it is working ok and have shown the command window output for a solving a simple frame.

My question is, is there a way you can "rollback" on a user input? My program requires the user make many inputs and it is very easy to make a mistake, which is frustrating because you must then enter the 20+ previous inputs again. So, if there is an option to rollback to the previous input it would be extreamly usefull.

Thank You
Elbarto








<<<<<<<<<<<<<<<<<<Enter Node Geometry, Number of members>>>>>>>>>>>>>>>>>>
Enter Number Of Nodes:3
Enter X Co-Ordinate of Node 1:0
Enter Y Co-Ordinate of Node 1:0
Enter X Co-Ordinate of Node 2:100
Enter Y Co-Ordinate of Node 2:0
Enter X Co-Ordinate of Node 3:200
Enter Y Co-Ordinate of Node 3:-75
Enter Number Of Members:2
Enter Node i for Member 1:1
Enter Node j for Member 1:2
Enter Node i for Member 2:2
Enter Node j for Member 2:3
<<<<<<<<<<<<<<<<<<Section properties>>>>>>>>>>>>>>>>>>
Enter E for material {enter 0 for steel}:1e4
Do you wish to use more then 1 section [y/n]?:n
Enter Area m^2 for all members:10
Enter Second Moment of Area (m^4) for all Members:1e3
<<<<<<<<<<<<<<<<<<Member Releases>>>>>>>>>>>>>>>>>>
Would you like to release the Moment (Mz) of a member [y/n]?:n
<<<<<<<<<<<<<<<<<<Enter in Restraint Data>>>>>>>>>>>>>>>>>>
Enter Restraint Code For Node1 {"1 1 1" is fixed}:1 1 1
Enter Restraint Code For Node2 {"1 1 1" is fixed}:0 0 0
Enter Restraint Code For Node3 {"1 1 1" is fixed}:1 1 1
<<<<<<<<<<<<<<<<<<Enter in apllied load data>>>>>>>>>>>>>>>>>>
Enter Applied load vector {R} For Node1 {"Fx Fy M"}:0 0 0
Enter Applied load vector {R} For Node2 {"Fx Fy M"}:0 -10 -1000
Enter Applied load vector {R} For Node3 {"Fx Fy M"}:0 0 0
<<<<<<<<<<<<<<<<<<FIXED END ACTIONS>>>>>>>>>>>>>>>>>>
Are there any member loads (ie Fixed end actions) [y/n]?:y
Enter members with applied member loads ie (# # #):1 2
Enter point loads at mid span for member_1 (Fx Fy) GLOBAL:0 0
Enter point loads at mid span for member_1 (fx fy) LOCAL:0 0
Enter Distributed load for member_1 (w) LOCAL:-0.2
Enter point loads at mid span for member_2 (Fx Fy) GLOBAL:0 -20
Enter point loads at mid span for member_2 (fx fy) LOCAL:0 0
Enter Distributed load for member_2 (w) LOCAL:0
............
RESULTS
............
Nodal Displacments {rf}
r2x = -0.019
r2y = -0.09408
theata_2 = -0.001826
............
Support Reactions {Rs}
R1x = 19
R1y = 10.33
M1 = 365.8
R3x = -19
R3y = 39.67
M3 = -875
............
Basic Member Forces {S}
Mi1 = 365.8
Mj1 = -332.8
F1 = -19
.
Mi2 = -667.2
Mj2 = -875
F2 = -39
.
............
 
Physics news on Phys.org
elbarto, here's something to think about that might be helpful to you. Break up your code into logical sections, with the first section getting user input. After the user has entered all 20+ input values, present them all to the user in a numbered list, and ask him/her to confirm that they are correct. If so, continue as before. If not, ask the user which input to change by typing the number of the one to change. After each change, ask whether the user wants to change another value.

When the user is satisfied with the changes, control flow proceeds as before.