主要内容

Results for


We launched the Discussions area with 6 channels, based on the existing types of content we see today in the MATLAB Central community.
I'm curious which channels you are most interested in participating, or which channels are missing.
Tell us your thoughts here!
Adam Danz just launched a new blog about MATLAB Graphics and App Building.
As you know, He has been a prolific contributor to MATLAB Answers and one of his answers recently won the Editor's Choice Award.
If there are any topics or questions you are interested in, please share with Adam, and I am sure he will get those into his blog.
4 months ago, the new API was published to access content on the MATLAB Central community. I shared my MATLAB code to access the API at that time, but the team just released the official SDK.
Houman and Rameez will talk about how you can model wireless networks (5G, WLAN, Bluetooth, 802.11ax WLAN mesh, etc.) in MATLAB in the upcoming livestream. They will start with the basics such as nodes, links, topology and metrics. Then they will introduce a new free add-on library that lets you model such networks, and show you how to use it.
Bookmark this link:
Congratulations, @Adam Danz for winning the Editor's Pick badge awarded for MATLAB Answers, in recognition of your awesome solution in overlapping images in grid layout.
Thank you for going to great lengths to help a user in this thread by suggesting alternative approach to representing stack of playing cards in MATLAB, highlighting very interesting features like hggroup.
This badge recognizes awesome answers people contribute and yours was picked for providing a very detailed and helpful answer.
Thank you so much for setting a high standard for MATLAB Answers and for your ongoing contribution to the community.
MATLAB Central Team
Congratuations, @Voss, for htting this important miletone!
You had a meteoric rise to in our community since you started answering questions in June 2020.
You provided 3218 answers and 926 votes. You are ranked #23 in the community. Thank you for your contribution to the community and please keep up the good track record!
MATLAB Central Team
MATLAB Onramp is a free online tutorial and it has been very popular with new MATLAB users to learn how to use it, and MathWorks have been adding more and more modules. The lastest one just dropped https://matlabacademy.mathworks.com/details/power-systems-simulation-onramp/orps
It shows you the basics of power system simulation by modeling a simple microgrid. You will learn how to simulate and measure three-phase circuits, and how to evaluate algorithms like droop control and maximum power point tracking.
Thats the task:
Given a square cell array:
x = {'01', '56'; '234', '789'};
return a single character array:
y = '0123456789'
I wrote a code that passes Test 1 and 2 and one that passes Test 3 but I'm searching a condition so that the code for Test 3 runs when the cell array only contains letters and the one for Test 1 and 2 in every other case. Can somebody help me?
This is my code:
y = []
[a,b]=size(x)
%%TEST 3
delimiter=zeros(1,a)
delimiter(end)=1
delimiter=repmat(delimiter,1,b)
delimiter(end)=''
delimiter=string(delimiter)
y=[]
for i=1:a*b
y = string([y x(i)])
end
y=join(y,delimiter)
y=erase(y,'0')
y=regexprep(y,'1',' ')
%%TEST 1+2
for i=1:a*b
y = string([y x(i)])
y=join(y)
end
y=erase(y,' ' )
Here's a screenshot from 22 years ago. Thanks for building one of the best engineering and science communities together.
That's the question: Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them comprise sides of a right-angled triangle. Return true if they do, otherwise return false .
I wrote this code but it doesn't pass test 7. I don't really understand why it isn't working. Can somebody help me?
function flag = isTherePythagoreanTriple(a, b, c, d)
a2=a^2
b2=b^2
c2=c^2
d2=d^2
format shortG
if a2+b2==c2
flag=true
else if a2+b2==d2
flag=true
else if a2+c2==d2
flag=true
else if c2+b2==d2
flag=true
else flag=false
end
end
end
end
end
That's the question:
The file cars.mat contains a table named cars with variables Model, MPG, Horsepower, Weight, and Acceleration for several classic cars.
Load the MAT-file. Given an integer N, calculate the output variable mpg.
Output mpg should contain the MPG of the top N lightest cars (by Weight) in a column vector.
I wrote this code and the resulting column vector has the right values but it doesn't pass the tests. What's wrong?
function mpg = sort_cars(N)
load cars.mat
sorted=sortrows(cars,4)
mpg = sorted(1:N,2)
end

Hello, an intern working at MathWorks is finishing up his program soon and he would like to interview some MATLAB users. He is looking for people who can give their perspective on the question:
"What makes MATLAB and Simulink special in comparison to other languages?"
Ultimately he plans to condense the answers into 15-second videos or sound bites.
If people are willing to participate but want more time to talk about their experience with MATLAB, he doesn't have time left for in-depth interviews but he can find someone else to take over the project.
Please send me an email via my profle if you are interested.
Yes, in my company that I own
35%
Yes, for someone else (or Univ.)
21%
Only for free, for charities
13%
Only in my charitable foundation
5%
No, I'd just play, travel, & relax
25%
15668 个投票
1
33%
2
34%
3
18%
4
5%
5
3%
6+
6%
1643 个投票
half full.
12%
half empty.
4%
both.
12%
twice as big as it needs to be.
15%
1/2 full of beer, 1/2 full of air.
17%
What glass???
39%
6618 个投票
I recently have found that I am no longer able to give my difficulty rating for questions on Cody after sucessfully completing a question. This is obviously not a big deal, I was just wondering if this was an issue on my end or if there was some change that I was not aware of.
The option to rate does not pop up after solving a problem, and the rating in general does not even show up anymore when answering questions (though it is visible from problem groups).

Getting Started with Simulink | Tips and Tricks to Get the Most Out of Simulink
Watch live as Tianyi Zhu and Ashwin Dhawad walk through how you can get started with Simulink by modeling, simulating, and tuning a PID controller for a DC Motor. This session isn’t just for beginners; they will show you the latest and greatest tips and tricks to help you get the most out of Simulink.
Date & Time: May 25, 2023 at 11:00 am EDT (see time in your time zone)
MATLAB Central has been great community-based MATLAB resources, but you can now access its content programmatically via the public API, and I created a MATLAB function to take advantage of that. You can learn more here https://api.mathworks.com/community
Example:
data = searchMATLABCentral("plotting",scope="matlab-answers",sort_order="created desc",created_after=datetime("2023-01-01"));
T = struct2table(data.items);
T(:,["created_date","title","is_answered"])
Output
Function
function results = searchMATLABCentral(query,options)
% SEARCGMATLABCENTRAL retrieves content of the MATLAB Central for a given
% query and returns the result as a struct.
% The function uses MathWorks RESTful API to search for content.
% The API is rate limited via IP throttling. No authentication is required.
% See API documentation for more details https://api.mathworks.com/community
%
% Input Arguments:
%
% query (string) - Required. The search query string.
% scope (string) - Optional. Specify the artifact. If not specified,
% the scope defaults to 'matlab-answers'.
% Other options include 'file-exchange','blogs','cody',
% 'community-highlights', and 'community-contests'.
% tags (string) - Optional. Specify a comma-separated list of tags.
% created_before (datetime) - Optional. Specify the last date in the results
% created_after (datetime) - Optional. Specify the first date in the results
% sort_order (string) - Optional. Speficy the order of the results.
% If not specified, it defaults to "relevance desc".
% Other options include 'created asc', 'created desc',
% 'updated asc','updated desc', 'relevance asc',
% and 'relevance desc'.
% page (integer) - Optional. Specify the page to retrieve.
% If the 'has_more' field in the result is positive,
% increment this argument to retrieve the next page.
% count (integer) - Optional. Specify the number of results as a value
% between 1 and 50; The default is 10.
%
% Output Arguments:
%
% results (struct) - Structure array containing the results of the search.
% validate input arguments
arguments
query string {mustBeNonzeroLengthText,mustBeTextScalar}
options.scope string {mustBeMember(options.scope,["matlab-answers", ...
"file-exchange","blogs","cody","community-highlights", ...
"community-contests"])} = "matlab-answers";
options.tags string {mustBeNonzeroLengthText,mustBeVector}
options.created_before (1,1) datetime
options.created_after (1,1) datetime
options.sort_order string {mustBeMember(options.sort_order,["created asc", ...
"created desc","updated asc","updated desc","relevance asc","relevance desc"])}
options.page double {mustBeInteger,mustBeGreaterThan(options.page,0)}
options.count double {mustBeInteger,mustBeInRange(options.count,1,50)}
end
% API URL and endpoint
url = "https://api.mathworks.com/community";
endpoint = "/v1/search";
% convert MATLAB datetime to the internet datetime format string
if isfield(options,"created_before")
options.created_before = string(options.created_before,"yyyy-MM-dd'T'HH:mm:ss'Z'");
end
if isfield(options,"created_after")
options.created_after = string(options.created_after,"yyyy-MM-dd'T'HH:mm:ss'Z'");
end
% convert optional inputs into a cell array of key-value pairs
keys = fieldnames(options);
vals = struct2cell(options);
params = [keys,vals].';
% call the API
try
results = webread(url+endpoint,"query",query,params{:});
catch ME
rethrow(ME)
end
end