結果:
キーと値の組み合わせでデータを格納できるディクショナリ。R2022bでdictionaryコマンドが登場し、最近のバージョンではreaddictionaryとwritedictionaryでJSONファイルからの読み込み・書き込みにも対応しました。
私はMIDIデータからピアノの演奏動画を作るプログラムで、ディクショナリを使いました。音のノート番号をキーにして、patchで白と黒で鍵盤を塗りつぶしたmatlab.graphics.Graphicsデータ型を値にしたディクショナリで保存して、MIDIで鳴らされた音のノート番号からlookupでグラフのオブジェクトを取得し、FaceColorを変更してハイライトするというもの。

皆さんはディクショナリを使ってますか? もし使っていたら、どういう活用をしているか、聞かせてください!
どの方法を使う事が多いですか?他によく使う方法があれば教えてくださいー。
方法①
Livescript 上で for ループ内で描画を編集させて描いた動画は「アニメーションのエクスポート」から動画ファイルに出力するのが一番簡単ですね。再生速度やら細かい設定ができない点は要注意。

方法②
exportgraphics 関数で "Append" オプション指定で実現できるようになった(R2022a から)のでこれも便利ですね。
N = 100;
x = linspace(0,4*pi,N);
y = sin(x);
filename = 'animation_sample.gif'; % Specify the output file name
if exist(filename,'file')
delete(filename)
end
h = animatedline;
axis([0,4*pi,-1,1]) % x軸の表示範囲を固定
for k = 1:length(x)
addpoints(h,x(k),y(k)); % ループでデータを追加
exportgraphics(gca,filename,"Append",true)
end
方法③
R2021b 以前のバージョンだとこんな感じ。
各ループで画面キャプチャして、imwrite で動画ファイルにフレーム追加していくイメージです。"DelayTime" を使って細かい指定ができるので、必要に応じて今でも利用します。
for k = 1:length(x)
addpoints(h,x(k),y(k)); % ループでデータを追加
drawnow % グラフアップデート
frame = getframe(gcf); % Figure 画面をムービーフレーム(構造体)としてキャプチャ
tmp = frame2im(frame); % 画像に変更
[A,map] = rgb2ind(tmp,256); % RGB -> インデックス画像に
if k == 1 % 新規 gif ファイル作成
imwrite(A,map,filename,'gif','LoopCount',Inf,'DelayTime',0.2);
else % 以降、画像をアペンド
imwrite(A,map,filename,'gif','WriteMode','append','DelayTime',0.2);
end
end
これからは生成AIでコードを1から書くという事が減ってくるのかと思いますが,皆さんがMATLABのコードを書く時に意識しているご自身のルールのようなものがあれば教えてください.
MATLAB言語は柔軟に書けますが,自然と個人個人のルールというものが出来上がってきているのでは,と思います.
私はParameter, Valueペアの引数がある関数はそれぞれのペアを新しい行に書く,というのをよくやります.
h = plot(x, y, "ro-", ...
"LineWidth", 2, ...
"MarkerSize", 10, ...
"MarkerFaceColor", "g");
Parameter=Valueでも同じです.
h = plot(x, y, "ro-", ...
LineWidth = 2, ...
MarkerSize = 10, ...
MarkerFaceColor = "g");
また,一時期は "=" を揃えることもやってました(今はやってませんが).
h = plot(x, y, "ro-", ...
LineWidth = 2, ...
MarkerSize = 10, ...
MarkerFaceColor = "g");
皆さんにはどのようなルールがありますか?
The Graphics and App Building Blog just launched its first article on R2025a features, authored by Chris Portal, the director of engineering for the MATLAB graphics and app building teams.
Over the next few months, we'll publish a series of articles that showcase our updated graphics system, introduce new tools and features, and provide valuable references enriched by the perspectives of those involved in their development.
To stay updated, you can subscribe to the blog (look for the option in the upper left corner of the blog page). We also encourage you to join the conversation—your comments and questions under each article help shape the discussion and guide future content.
昨日 5/29 にお台場で MATLAB EXPO が開催されました。ご参加くださった方々ありがとうございました!
私は AI 関連のデモ展示で解説員としても立っておりましたが、立ち寄ってくださる方が絶えず、ずっと喋り続けてました。また、講演後に「さっきのすごくね?」という会話が漏れ聞こえてきたのがハイライト。
参加されたみなさま、印象に残ったこと・気になった講演・ポスター・デモ・新機能等あったら教えてください!(次回に向けて運営面での感想も)

以前のEXPOでも参加・聴講したことがある
67%
知り合いから聞いた
0%
MathWorksからのプロモーション,EXPOサイトで知った
0%
今年のEXPO会場でたまたま見かけた
0%
ライトニングトークって何?
33%
3 票
I like this problem by James and have solved it in several ways. A solution by Natalie impressed me and introduced me to a new function conv2. However, it occured to me that the numerous test for the problem only cover cases of square matrices. My original solutions, and Natalie's, did niot work on rectangular matrices. I have now produced a solution which works on rectangular matrices. Thanks for this thought provoking problem James.
I have written, tested, and prepared a function with four subsunctions on my computer for solving one of the problems in the list of Cody problems in MathWorks in three days. Today, when I wanted to upload or copy paste the codes of the function and its subfunctions to the specified place of the problem of Cody page, I do not see a place to upload it, and the ability to copy past the codes. The total of the entire codes and their documentations is about 600 lines, which means that I cannot and it is not worth it to retype all of them in the relevent Cody environment after spending a few days. I would appreciate your guidance on how to enter the prepared codes to the desired environment in Cody.
Hello Community,
We're excited to announce that registration is now open for the MathWorks AUTOMOTIVE CONFERENCE 2025! This event presents a fantastic opportunity to connect with MathWorks and industry experts while exploring the latest trends in the automotive sector.
Event Details:
- Date: April 29, 2025
- Location: St. John’s Resort, Plymouth, MI
Featured Topics:
- Virtual Development
- Electrification
- Software Development
- AI in Engineering
Whether you're a professional in the automotive industry or simply interested in these cutting-edge topics, we highly encourage you to register for this conference.
We look forward to seeing you there!
We are excited to announce another update to our Discussions area: the new Contribution Widget! The new widget simplifies the process of creating diverse types of content, whether you're praising someone who has helped you, sharing tips and tricks, or polling the community.

Previously, creating various types of content required navigating multiple links or channels. With the new Contribution Widget, everything you need is conveniently located in one place.
Give it a try and let us know how we can further enhance your user experience.
P.S. Who has been particularly helpful to you lately? Create your first praise post and let them know!
I've been trying this problem a lot of time and i don't understand why my solution doesnt't work.
In 4 tests i get the error Assertion failed but when i run the code myself i get the diag and antidiag correctly.
function [diag_elements, antidg_elements] = your_fcn_name(x)
[m, n] = size(x);
% Inicializar los vectores de la diagonal y la anti-diagonal
diag_elements = zeros(1, min(m, n));
antidg_elements = zeros(1, min(m, n));
% Extraer los elementos de la diagonal
for i = 1:min(m, n)
diag_elements(i) = x(i, i);
end
% Extraer los elementos de la anti-diagonal
for i = 1:min(m, n)
antidg_elements(i) = x(m-i+1, i);
end
end
Creating data visualizations
79%
Interpreting data visualizations
21%
28 票
Have you ever wanted to search for a community member but didn't know where to start? Or perhaps you knew where to search but couldn't find enough information from the results? You're not alone. Many community users have shared this frustration with us. That's why the community team is excited to introduce the new ‘People’ page to address this need.

What Does the ‘People’ Page Offer?
- Comprehensive User Search: Search for users across different applications seamlessly.
- Detailed User Information: View a list of community members along with additional details such as their join date, rankings, and total contributions.
- Sorting Options: Use the ‘sort by’ filter located below the search bar to organize the list according to your preferences.
- Easy Navigation: Access the Answers, File Exchange, and Cody Leaderboard by clicking the ‘Leaderboards’ button in the upper right corner.
In summary, the ‘People’ page provides a gateway to search for individuals and gain deeper insights into the community.
How Can You Access It?
Navigate to the global menu, click on the ‘More’ link, and you’ll find the ‘People’ option.

Now you know where to go if you want to search for a user. We encourage you to give it a try and share your feedback with us.
My following code works running Matlab 2024b for all test cases. However, 3 of 7 tests fail (#1, #4, & #5) the QWERTY Shift Encoder problem. Any ideas what I am missing?
Thanks in advance.
keyboardMap1 = {'qwertyuiop[;'; 'asdfghjkl;'; 'zxcvbnm,'};
keyboardMap2 = {'QWERTYUIOP{'; 'ASDFGHJKL:'; 'ZXCVBNM<'};
if length(s) == 0
se = s;
end
for i = 1:length(s)
if double(s(i)) >= 65 && s(i) <= 90
row = 1;
col = 1;
while ~strcmp(s(i), keyboardMap2{row}(col))
if col < length(keyboardMap2{row})
col = col + 1;
else
row = row + 1;
col = 1;
end
end
se(i) = keyboardMap2{row}(col + 1);
elseif double(s(i)) >= 97 && s(i) <= 122
row = 1;
col = 1;
while ~strcmp(s(i), keyboardMap1{row}(col))
if col < length(keyboardMap1{row})
col = col + 1;
else
row = row + 1;
col = 1;
end
end
se(i) = keyboardMap1{row}(col + 1);
else
se(i) = s(i);
end
% if ~(s(i) = 65 && s(i) <= 90) && ~(s(i) >= 97 && s(i) <= 122)
% se(i) = s(i);
% end
end
私の場合、前の会社が音楽認識アプリの会社で、アルゴリズム開発でFFTが使われていたことがきっかけでした。でも、MATLABのすごさが分かったのは、機械学習のオンライン講座で、Andrew Ngが、線型代数を使うと、数式と非常に近い構文のコードで問題が処理できることを学んだ時でした。
Let's celebrate what made 2024 memorable! Together, we made big impacts, hosted exciting events, and built new apps.


Resource links:
Toolbox 全部入りの MATLAB ライセンス
67%
まだ持っていない Toolbox (下記にコメントください)
0%
MATLAB T シャツ
17%
MATLAB ルービックキューブ
0%
MATLAB 靴下
6%
MathWorks オフィス訪問チケット
11%
18 票
この場は MATLAB や Simulink を使っている皆さんが、気軽に質問や情報交換ができる場所として作られました。日本語でも気軽に投稿ができるように今回日本語チャネルを解説します。
ユーザーの皆様とのやり取りを通じて、みんなで知識や経験を共有し、一緒にスキルアップしていきましょう。 どうぞお気軽にご参加ください。
そして日本語チャネル開設にあたってコメントくださった皆様、ありがとうございます!
We’d like to announce a change on the Machine Translation feature on MATLAB Answers.
When users are visiting our international domains (e.g. China or Japan), Answers provides the option to translate the content. Recently, we identified several security threats involving high-volume requests from certain IP addresses targeting our translation service.
As one of the countermeasures, we have now placed the Machine Translation feature behind a login requirement. While non-logged-in users will still see the 'Translate' button, it will be inactive (greyed out) until they log in.
We are actively collaborating with adjacent teams to develop solutions to better detect and block malicious requests.
Please let us know if you have any questions or concerns.