MATLAB Central Discussions - Join the conversation!

参加しましょう!

ディスカッションは、仲間と出会い、共に大きな課題に挑戦し、楽しみながら学べる交流の場です。

  • 最新アップデートの情報は、ハイライトでご確認いただけます。
  • MATLAB や Simulink のスキルアップに役立つヒントやコツも充実しています。
  • 数学にまつわる面白い冗談やダジャレ、ミームは娯楽セクションで楽しめます。
  • また、新しいチャネルについてのアイデアやご提案もお待ちしています。
サインインして参加する

更新されたディスカッション


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
Adam Danz
Adam Danz
最後のアクティビティ: 2025 年 2 月 25 日 9:31

Do you boast about the energy savings you racking up by using dark mode while stashing your energy bill savings away for an exotic vacation🌴🥥? Well, hold onto your sun hats and flipflops!
A recent study presented at the 1st Internaltional Workshop on Low Carbon Computing suggests that you may be burning more ⚡energy⚡ with your slick dark displays 💻[1].
In a 2x2 factorial design, ten participants viewed a webpage in dark and light modes in both dim and lit settings using an LCD monitor with 16 brightness levels.
  • 80% of participants increased the monitor's brightness in dark mode [2]
  • This occurred in both lit and dim rooms
  • Dark mode did not reduce power draw but increasing monitor brightness did.
The color pixels in an LCD monitor still draw voltage when the screen is black, which is why the monitor looks gray when displaying a pure black background in a dark room. OLED monitors, on the other hand, are capable of turning off pixels that represent pure black and therefore have the potential to save energy with dark mode. A 2021 Purdue study estimates a 3%-9% energy savings with dark mode on OLED monitors using auto-brightness [3]. However, outside of gaming, OLED monitors have a very small market share and still account for less than 25% within the gaming world.
Any MATLAB users out there with OLED monitors? How are you going to spend your mad cash savings when you start using MATLAB's upcoming dark theme?
  1. BBC study: https://www.sicsa.ac.uk/wp-content/uploads/2024/11/LOCO2024_paper_12.pdf
  2. BBC blog article https://www.bbc.co.uk/rd/articles/2025-01-sustainability-web-energy-consumption
  3. 2021 Purdue https://dl.acm.org/doi/abs/10.1145/3458864.3467682
Mike Croucher
Mike Croucher
最後のアクティビティ: 2025 年 2 月 24 日 22:04

tiledlayout(4,1);
% Plot "L" (y = 1/(x+1), for x > -1)
x = linspace(-0.9, 2, 100); % Avoid x = -1 (undefined)
y =1 ./ (x+1) ;
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
xlim([-10,10])
% Plot "O" (x^2 + y^2 = 9)
theta = linspace(0, 2*pi, 100);
x = 3 * cos(theta);
y = 3 * sin(theta);
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
% Plot "V" (y = -2|x|)
x = linspace(-1, 1, 100);
y = 2 * abs(x);
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
% Plot "E" (x = -3 |sin(y)|)
y = linspace(-pi, pi, 100);
x = -3 * abs(sin(y));
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
Athanasios Paraskevopoulos
Athanasios Paraskevopoulos
最後のアクティビティ: 2025 年 2 月 24 日 7:34

Hi everyone,

I've recently joined a forest protection team in Greece, where we use drones for various tasks. This has sparked my interest in drone programming, and I'd like to learn more about it. Can anyone recommend any beginner-friendly courses or programs that teach drone programming?

I'm particularly interested in courses that focus on practical applications and might align with the work we do in forest protection. Any suggestions or guidance would be greatly appreciated!

Thank you!

Hannah
Hannah
最後のアクティビティ: 2025 年 2 月 21 日 16:34


On 27th February María Elena Gavilán Alfonso and I will be giving an online seminar that has been a while in the making. We'll be covering MATLAB with Jupyter, Visual Studio Code, Python, Git and GitHub, how to make your MATLAB projects available to the world (no installation required!) and much much more.
cui,xingxing
cui,xingxing
最後のアクティビティ: 2025 年 2 月 21 日 1:09

Check out the result of "emoji matrix" multiplication below.
  • vector multiply vector:
a = ["😁","😁","😁"]
Warning: Function mtimes has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Warning: Function mtimes has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
a = 1x3 string array
"😁" "😁" "😁"
b = ["😂";
"😂"
"😂"]
b = 3x1 string array
"😂" "😂" "😂"
c = a*b
c = "😁😂😁😂😁😂"
  • matrix multiply matrix:
matrix1 = [
"😀", "😃";
"😄", "😁"]
matrix1 = 2x2 string array
"😀" "😃" "😄" "😁"
matrix2 = [
"😆", "😅";
"😂", "🤣"]
matrix2 = 2x2 string array
"😆" "😅" "😂" "🤣"
resutl = matrix1*matrix2
resutl = 2x2 string array
"😀😆😃😂" "😀😅😃🤣" "😄😆😁😂" "😄😅😁🤣"
enjoy yourself!
Steve Eddins
Steve Eddins
最後のアクティビティ: 2025 年 2 月 20 日 17:45

General observations on practical implementation issues regarding add-on versioning
I am making updates to one of my File Exchange add-ons, and the updates will require an updated version of another add-on. The state of versioning for add-ons seems to be a bit of a mess.
First, there are several sources of truth for an add-on’s version:
  • The GitHub release version, which gets mirrored to the File Exchange version
  • The ToolboxVersion property of toolboxOptions (for an add-on packaged as a toolbox)
  • The version in the Contents.m file (if there is one)
Then, there is the question of how to check the version of an installed add-on. You can call matlab.addon.installedAddons, which returns a table. Then you need to inspect the table to see if a particular add-on is present, if it is enabled, and get the version number.
If you can get the version number this way, then you need some code to compare two semantic version numbers (of the form “3.1.4”). I’m not aware of a documented MATLAB function for this. The verLessThan function takes a toolbox name and a version; it doesn’t help you with comparing two versions.
If add-on files were downloaded directly and added to the MATLAB search path manually, instead of using the .mtlbx installer file, the add-on won’t be listed in the table returned by matlab.addon.installedAddon. You’d have to call ver to get the version number from the Contents.m file (if there is one).
Frankly, I don’t want to write any of this code. It would take too long, be challenging to test, and likely be fragile.
Instead, I think I will write some sort of “capabilities” utility function for the add-on. This function will be used to query the presence of needed capabilities. There will still be a slight coding hassle—the client add-on will need to call the capabilities utility function in a try-catch, because earlier versions of the add-on will not have that utility function.
I also posted this over at Harmonic Notes
Image Analyst
Image Analyst
最後のアクティビティ: 2025 年 2 月 19 日 17:51



I am very pleased to share my book, with coauthors Professor Richard Davis and Associate Professor Sam Toan, titled "Chemical Engineering Analysis and Optimization Using MATLAB" published by Wiley: https://www.wiley.com/en-us/Chemical+Engineering+Analysis+and+Optimization+Using+MATLAB-p-9781394205363
Also in The MathWorks Book Program:
Chemical Engineering Analysis and Optimization Using MATLAB® introduces cutting-edge, highly in-demand skills in computer-aided design and optimization. With a focus on chemical engineering analysis, the book uses the MATLAB platform to develop reader skills in programming, modeling, and more. It provides an overview of some of the most essential tools in modern engineering design.
Chemical Engineering Analysis and Optimization Using MATLAB® readers will also find:
  • Case studies for developing specific skills in MATLAB and beyond
  • Examples of code both within the text and on a companion website
  • End-of-chapter problems with an accompanying solutions manual for instructors
This textbook is ideal for advanced undergraduate and graduate students in chemical engineering and related disciplines, as well as professionals with backgrounds in engineering design.
Brent
Brent
最後のアクティビティ: 2025 年 2 月 18 日 20:13

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
Walter Roberson
Walter Roberson
最後のアクティビティ: 2025 年 2 月 18 日 15:52

Are there parts of MATLAB that could disappear as far as you were concerned, things you don't need or which were "bad ideas" or which cause more trouble than they are worth in your experience?
One suggestion per answer please, so we can see how other people feel about the same matters.
Adam
Adam
最後のアクティビティ: 2025 年 2 月 17 日 2:45

I am looking for a Simulink tutor to help me with Reinforcement Learning Agent integration. If you work for MathWorks, I am willing to pay $30/hr. I am working on a passion project, ready to start ASAP. DM me if you're interested.
Toshiaki Takeuchi
Toshiaki Takeuchi
最後のアクティビティ: 2025 年 2 月 16 日 12:48

私の場合、前の会社が音楽認識アプリの会社で、アルゴリズム開発でFFTが使われていたことがきっかけでした。でも、MATLABのすごさが分かったのは、機械学習のオンライン講座で、Andrew Ngが、線型代数を使うと、数式と非常に近い構文のコードで問題が処理できることを学んだ時でした。
Hans Scharler
Hans Scharler
最後のアクティビティ: 2025 年 2 月 15 日 17:31

The MATLAB AI Chat Playground is now open to the whole community! Answer questions, write first draft MATLAB code, and generate examples of common functions with natural language.
The playground features a chat panel next to a lightweight MATLAB code editor. Use the chat panel to enter natural language prompts to return explanations and code. You can keep chatting with the AI to refine the results or make changes to the output.
MATLAB AI Chat Playground
Give it a try, provide feedback on the output, and check back often as we make improvements to the model and overall experience.
Walter Roberson
Walter Roberson
最後のアクティビティ: 2025 年 2 月 15 日 16:47

This topic is for discussing highlights to the current R2025a Pre-release.
Since May 2023, MathWorks officially introduced the new Community API(MATLAB Central Interface for MATLAB), which supports both MATLAB and Node.js languages, allowing users to programmatically access data from MATLAB Answers, File Exchange, Blogs, Cody, Highlights, and Contests.
I’m curious about what interesting things people generally do with this API. Could you share some of your successful or interesting experiences? For example, retrieving popular Q&A topics within a certain time frame through the API and displaying them in a chart.
If you have any specific examples or ideas in mind, feel free to share!
imad
imad
最後のアクティビティ: 2025 年 2 月 14 日 16:42

Simulink has been an essential tool for modeling and simulating dynamic systems in MATLAB. With the continuous advancements in AI, automation, and real-time simulation, I’m curious about what the future holds for Simulink.
What improvements or new features do you think Simulink will have in the coming years? Will AI-driven modeling, cloud-based simulation, or improved hardware integration shape the next generation of Simulink?
Go to top of page