Mesh error on my Matlab R2024a home edition

조회 수: 4 (최근 30일)
Andrew
Andrew 2024년 11월 1일
편집: Walter Roberson 2024년 11월 1일
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?

채택된 답변

Steven Lord
Steven Lord 2024년 11월 1일
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
Andrew
Andrew 2024년 11월 1일
이동: Steven Lord 2024년 11월 1일
Thanks, I forgot that I had creared a strings.m a few years ago (using chebfun).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by