Mesh error on my Matlab R2024a home edition

5 views (last 30 days)
HI,
Over the years I have purchased Matlab 2016b, Matlab R2021a, and Matlab R2024a. All home edition versions.
I can run this code on my Matlab 2016b, Matlab R2021a versions and produce my little video (see below):
clear
clc
writerObj = VideoWriter('C:\Users\CefnG\Documents\MATLAB\EExp5151_split','MPEG-4');%Name of video file
open(writerObj);
fig1 = figure(1);
load EExp5151_split.TNO %Read in the file generated by Microcap 12 -No headers
d1 = EExp5151_split;
timestamp = d1(:,1);
d1(:,1)=[];%Remove time
rws=51; %Get this number from the Microcap 12 netlist
cols=51; %Get this number from the Microcap 12 netlist
s=size(d1);
d1ct=1;
for k = 1:s(1)
for j=1:rws
for i=1:cols
Z(j,i)=d1(k,d1ct);
d1ct=d1ct+1;
end
end
d1ct=1;
x=1:1:rws;
xx=1:1:rws;%put in an increment for spline command
for p=1:cols
y=Z(:,p);
yy(:,p)=spline(x,y,xx);
end
syy=size(yy);
x=1:1:cols;
xx=1:1:cols; %put in an increment for spline command
for p=1:syy(1)
y=yy(p,:);
Zz(p,:)=spline(x,y,xx);
end
s2=size(Zz);
mztb=zeros(1,s2(2)+2);
sidez=zeros(s2(1),1);
Zc=[mztb;sidez Zz sidez;mztb];%put some 0's around the data
[X,Y] = meshgrid(1:1:s2(2)+2, 1:1:s2(1)+2);
mesh(X,Y,Zc);
view([-37 77])
title('53 by 53 grid (spline = 1)')
xlabel('X')
ylabel('Y')
txt = ['Time: ' num2str(timestamp(k,1)) ' secs'];
text(-15,-5,txt)
axis([1 s2(2)+2 1 s2(1)+2 -3 3])
F=getframe(fig1);
%write the current frame to the writer object
writeVideo(writerObj,F)
end
%Close the writer object. File appers in current folder
close(writerObj);
disp('Video File Written')
This what I get on my Matlab R2024a version:
Warning: Function strings has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential
name conflict.
> In Zsplined (line 6)
Execution of script strings as a function is not supported:
C:\Users\pc1\OneDrive\Documents\MATLAB\strings.m
Error in matlab.graphics.internal.configureAxes
Error in matlab.graphics.internal.configureAxes
Error in mesh (line 117)
matlab.graphics.internal.configureAxes(cax,x,y,z);
Error in Zsplined (line 46)
mesh(X,Y,Zc);
What can I do about the mesh error?

Accepted Answer

Steven Lord
Steven Lord on 1 Nov 2024
You have your own script named strings.m. MathWorks introduced a strings function in release R2016b and this function appears to be used by some of the internal tools that configure an axes before mesh creates a plot on it. [I don't know when that internal tool started using strings, likely after release R2021a since you indicated that did not error.] Rename your strings.m script file to avoid the conflict.
  1 Comment
Andrew Thorburn
Andrew Thorburn on 1 Nov 2024
Moved: Steven Lord on 1 Nov 2024
Thanks, I forgot that I had creared a strings.m a few years ago (using chebfun).

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!