File Exchange Pick of the Week

Our best user submissions

弦艺术II

Sean本周的选择也是stringartbyGiuseppe Cardillo. Jiro picked this上周;我已经写了这篇文章;这可能是我们历史上的第一个博客竞赛条件。

Contents

String Art

This is a fun program for creating string or thread art. Giuseppe gives more information on the theory and history in the
FEX post. Let’s see the default. Note if you run it, you’ll see the lines animating.

stringart

We can also adjust the number of sides, density, crossings and color.

strignart('Sides',5,'密度', 20,'Crossed', 1,'颜色', rand(1, 3))

Live Controls

Now, if you’re thinking that’s a lot of knobs to turn. This could be a good place forLive Controlsin a实时脚本. That way we can interactively adjust those parameters.

The live script can be downloaded from这里so you can play with it. R2018a or newer is required.

功能签名

好吧,那很有趣。但是,如果您不知道String Art具有哪些选项怎么办?朱塞佩给了我们四个名称值对
调整行为stringart. Starting in R2018a, we can writecode suggestionsthat will allow the live editor or tab-complete to provide information on these name-value pairs.

I added it for string art so now you can see what happens as I type.

In the live editor:

在命令行或普通代码文件中列表完成。

Writing Function Signatures

In order to create function signatures, you need to define afunctionSignatures.jsonfile and write the input schema. Here it is forstringart. I defined the type based on the attribute validation for each name-value pair.

{“ _schemaversion”:"1.0.0",“弦乐”: {"inputs": [ {"name":"Sides","kind":"namevalue","type":[[“数字”,"scalar",“真实的”,“整数”,">=3"],,"purpose":"Number of polygon sides"},{"name":“交叉”,"kind":"namevalue","type":[[“数字”,"scalar",“真实的”,“整数”,"<=1"],,"purpose":"Crossed or not"},{"name":“密度”,"kind":"namevalue","type":[[“数字”,"scalar",“真实的”,“整数”,“> = 10”],,"purpose":“每侧销数”},{"name":"Color","kind":"namevalue","type":[[“数字”,"row",“真实的”,"ncols=3",">=0","<=1"],,"purpose":"Color - RGB Triplet"} ] } }

Note:我通常在第三方编辑中编辑这些编辑,该编辑正确强调了JSON;在这种情况下,Visual Studio。

Comments

Do you have a use for live controls, function signatures, or a new hobby of making string art where simulating or prototyping
it with software would be faster than laying down pins?

Give it a try and let us know what you think这里or leave a评论for Giuseppe.

Published with MATLAB® R2018a

|
  • print
  • send email

Comments

To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.