Is it possible to use a function of Matlab toolbox without installing the tolboox itself?

Hi guys,
I need to use the function "wrapTo360" but I want to avoid installing the "Mapping toolbox".
Is it possible or do I have necessarily install the toolbox?
Thank you in advance!

 採用された回答

DGM
DGM 2022 年 3 月 16 日
編集済み: DGM 2022 年 3 月 16 日
You can just use basic tools to wrap angles.
A = -360:40:360
A = 1×19
-360 -320 -280 -240 -200 -160 -120 -80 -40 0 40 80 120 160 200 240 280 320 360
B1 = wrapTo360(A)
B1 = 1×19
0 40 80 120 160 200 240 280 320 0 40 80 120 160 200 240 280 320 360
B2 = mod(A,360);
mask = A>0 & B2==0;
B2(mask) = 360
B2 = 1×19
0 40 80 120 160 200 240 280 320 0 40 80 120 160 200 240 280 320 360

4 件のコメント

Hi @DGM, can you explain why to include the line following lines?
mask = A>0 & B2==0;
B2(mask) = 360
Not just the line first line is enough?
B2 = mod(A,360)
DGM
DGM 2022 年 5 月 24 日
編集済み: DGM 2022 年 5 月 24 日
That ensures that instances of 360 (and positive multiples) are mapped to 360 instead of 0, which replicates the behavior of wrapTo360(). If it weren't for the implicit requirement of replicating an existing behavior, I'd probably prefer to just use mod(). As to why that's the behavior of wrapTo360(), I'm not sure off the top of my head.
A = [0 360];
B1 = wrapTo360(A)
B1 = 1×2
0 360
B2 = mod(A,360)
B2 = 1×2
0 0
Giuseppe
Giuseppe 2022 年 5 月 24 日
Since I'm interested only in wrapping an angle in the interval [0deg 360deg], is it sufficient to use only mod()?
DGM
DGM 2022 年 5 月 25 日
That's up to you to decide. I'm not familiar with using wrapto360() in its intended applications, so I don't know if that little detail is important for some particular reason. If you're trying to use code that was written around using wrapto360(), I'd probably try to replicate its behavior unless I were certain that I didn't need it. It seems like a negligible compromise to make.

サインインしてコメントする。

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2022 年 3 月 16 日

1 投票

You would need to install the toolbox to have access to the functions it contains.
If you have access to MATLAB Online, you could try running your code there. All toolboxes you have access to are pre-loaded for you.

製品

リリース

R2022a

質問済み:

2022 年 3 月 16 日

コメント済み:

DGM
2022 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by