# I'm having trouble saving the matrix?

2 views (last 30 days)
studentmatlaber on 14 Apr 2022
Commented: Benjamin Thompson on 14 Apr 2022
Mxest1=(x_T_est1)';
Mxest1(isnan(Mxest1)) = [] %NANs
Myest1=(y_T_est1)';
Myest1(isnan(Myest1)) = [] %NANs
for n=1:length(Mxest1)
mae1=sum(sqrt((x_T-Mxest1(n)).^2+(y_T-Myest1(n)).^2));
end
mae1(1,1)=mae1/n
save('mae1.mat','mae1')
%for new value Mxest1 and Myest1
Mxest1=(x_T_est1)';
Mxest1(isnan(Mxest1)) = [] %NANs
Myest1=(y_T_est1)';
Myest1(isnan(Myest1)) = [] %NANs
for n=1:length(Mxest1)
mae1=sum(sqrt((x_T-Mxest1(n)).^2+(y_T-Myest1(n)).^2));
end
mae1(1,2)=mae1/n
save('mae1.mat','mae1')
Hello. I have 51 variegated Mxest1 and Myest1 values. I enter these values manually. As a result, the matrix I want should be mae1=1x51. After manually entering the first value, I save the first result at mae1(1,1). Then I want to save the second value at mae1(1,2). But it doesn't do it correctly. How can I do that? I would be glad if you help.
Benjamin Thompson on 14 Apr 2022
You have not defined x_T_est1 in your code listing.

### Categories

Find more on Matrices and Arrays in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by