Why are these two variables not the same value?

6 views (last 30 days)
I think I'm going crazy because I have two differently named variables both set equal to the same thing but they are returning different values. These are the variables:
Max.H1_E_RT_Moment_Max = max(abs(E.RT_Moment_Y_Ave));
Max.H2_E_RT_Moment_Max_Y = max(abs(E.RT_Moment_Y_Ave));
These are the returned values:
Max.H1_E_RT_Moment_Max = 57.7207
Max.H2_E_RT_Moment_Max_Y = 21.0916
Is there any reason why this might be happening?
  5 Comments
Walter Roberson
Walter Roberson on 10 Dec 2022
Is it practical to post the code and any relevant data, so we can test?
Joshua Lucas Ewert
Joshua Lucas Ewert on 10 Dec 2022
Edited: Joshua Lucas Ewert on 10 Dec 2022
Sure sure. Here's a google drive link with the files I've been using. https://drive.google.com/drive/folders/1w1taoyXov3IhRKbWZu-Ig6pvAtlpwMGi?usp=sharing
Let me know if it doesn't work.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Dec 2022
15 lines further down you have
Max.H2_E_RT_Moment_Max_Y = max(abs(E.RT_Moment_Z_Ave));
which overwrites the previous value.
  1 Comment
Joshua Lucas Ewert
Joshua Lucas Ewert on 10 Dec 2022
Oh my god, I'm so stupid sorry. I've done way too much copying and pasting and must have just overlooked it. So sorry to waste your time

Sign in to comment.

More Answers (0)

Categories

Find more on Variables in Help Center and File Exchange

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!