I have a .mat file with several variables. I want to make a change to a single column in one of the variables, and then save that changed .mat file so it has an identical variable structure as the original file. I have loaded the .mat file, successfully changed the column, but am having trouble saving it in the desired format.
First, I will illustrate what happened to explain what I mean. I loaded the .mat file and then applied the multiplier to one of the columns successfully. But when I save the .mat file, I get a different variable structure as shown in my BEFORE and AFTER images below. How do I save the .mat file AFTER making the change to the column so that it has an identical variable structure as the original .mat file (i.e. I want the BEFORE and AFTER variable structures to be the same). Right now the variable structures are different as shown below.
The code I used to load the original mat file, make the change to a single column, and then save the .mat file is shown after these images.
This is the structure of my .mat file at the start when I loaded the original .mat file into MATLAB:
This is the structure of the .mat file after I loaded the file into MATLAB, successfully changed my column, and saved the file (it's different than the BEFORE image, when I want this saved file to have an identical variable structure as the original .mat file shown above):
Here is the code that I used to load the original .mat file (shown in the BEFORE image above), and then make the change, and then save the chnage .mat file (shown in the AFTER image above). How do I save the .mat file with the changes but have the structure of the variables be identical to the original .mat file?
fullMatFileName = fullfile(folder, FileName')
if ~exist(fullMatFileName, 'file')
message = sprintf('%s does not exist', fullMatFileName);
s = load(fullMatFileName);
Thanks so much! I am very new to coding and appreciate the help.