How can I quickly find the difference in function usage between different MATLAB versions? For example, the Name-Value Arguments "QuoteStrings" of the function writetable
Afficher commentaires plus anciens
On the version of MATLAB 2021b, the following code is correct:
writetable(mytable,'result.csv','Delimiter',',','QuoteStrings',0)
However, the same code cannot run on my friend's computer. The version of MATLAB on his computer is 2022b.
From the official help document, we can see that the name value parameter "QuoteStrings" has modified the value parameter.
Previous version:
% 'QuoteStrings' A logical value that specifies whether to write
% text out enclosed in double quotes ("..."). If
% 'QuoteStrings' is true, any double quote characters that
% appear as part of a text variable are replaced by two
% double quote characters.
Latest version:
% "QuoteStrings" - A flag which specifies when to quote output text.
% - "minimal" (default) Any variables which contain
% the delimiter, line ending, or the double-quote
% character '"' will be quoted.
% - "all" All text, categorical, datetime, or
% duration variables will be quoted.
% - "none" No variables will be quoted.
Therefore, in order to avoid differences between different MATLAB versions, I can only change the code to:
try
writetable(mytable,'result.csv','Delimiter',',','QuoteStrings',0)
catch
writetable(mytable,'result.csv','Delimiter',',','QuoteStrings','none')
end
Similar situations are often encountered in many other functions. Many name-value parameters may be proposed in a newer version, but the MATLAB official website does not provide relevant compatibility suggestions.
For example, the 'CData' parameter in the bar function will report an error in MATLAB2017a.
So, what's a good way to quickly know the modification of a function? I hope you can give some good suggestions or share your experience. Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!