R2020b
Sean's pick this week is MATLAB R2020b by MathWorks Development.
Our fall 2020 release shipped this week. Today, I'll go over some of my favorite convenience features. You can read the full release notes here.
First and foremost - fileparts is vectorized now!!! This has been a longstanding wish:
[p,f,ext] = fileparts(fullfile(pwd, ["hello.m", "world.fig"]))
p = 1×2 string array "C:\Documents\MATLAB\potw\R2020b" "C:\Documents\MATLAB\potw\R2020b" f = 1×2 string array "hello" "world" ext = 1×2 string array ".m" ".fig"
If you want your function accept a file or folder, you can use mustBeFile and mustBeFolder as validators in an arguments block and it will validate that they exist. You'll also get tab-complete of file or folder names for free.
arguments filename (1, 1) string {mustBeFile} end
Have you ever wanted to read the lines of a text file and used either fileread which returns a long character vector or fgetl yourself? Well now you can use readlines!
t = readlines('mainR2020b.m');
t(1:4)
ans = 4×1 string array "%% R2020b" "%" "% <http://www.mathworks.com/matlabcentral/profile/authors/3208495 Sean>'s" "% pick this week is"
XML reading and writing has also always been a challenge. You can now read and write XML files with readstruct or writestruct.
s = imfinfo('cameraman.tif'); writestruct(s, 'cameraman.xml');
In the app building world, you can now set the Icon for the uifigure to a custom one, and export (print) the app.
uifigure("Icon", "HawaiiFlower.jpg", "Name", "Custom Icon Figure")
Comments
Give it a try and let us know what you think here.
- 类别:
- Picks
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。