다음에 대한 결과:
The AI Chat Playground at MATLAB Central has two new upgrades: OpenAI GPT-4o mini and MATLAB R2024b!
GPT-4o mini is a new language model from OpenAI and brings general knowledge up to October 2023. GPT-4o mini surpasses GPT-3.5 Turbo and other small models on academic benchmarks across both textual intelligence and reasoning. Our goal is to keep improving the output of the AI Chat Playground. This upgrade is available now: https://www.mathworks.com/matlabcentral/playground/
One more thing... we also updated the system to the latest release of MATLAB. This is R2024b and comes with hundreds of updates and new plot types to explore.Check out Mike Croucher's blog post about the latest version of MATLAB: https://blogs.mathworks.com/matlab/2024/09/13/the-latest-version-of-matlab-r2024b-has-just-been-released/
We are looking forward to your feedback on the updates to the AI Chat Playground. Let us know what you think and how you use this community app.
It's been over six years since I've written any serious MATLAB code, so I thought it would be fun to see how easily ChatGPT could help me out. While others have probably already used ChatGPT to generate MATLAB code, I didn't find any evidence of it when I searched through the ThingSpeak forum. That inspired me to post an example to get people thinking about it.
This example reads four temperature fields from the same channel and plots them on a single graph.
My ChatGPT prompt:
The prompt is pretty straightforward and essentially walks through all the elements of the chart that I wanted. It's also important to consider any filtering or "data cleansing" that should be done. Since this was my first time doing this, I decided to use an existing plot I was already familiar with as my "target state".
The prompt: "I would like you to generate some MATLAB code to create what is called a MATLAB Visualization. Its purpose will be to generate a chart of 4 fields found in a ThingSpeak channel. The ThingSpeak channel name is "Nest Nanny 2 (NN-02)" and its channel id (needed for the code) is xxxxxxx. The read api key is XXXXXXXXXXXXXXXX. The chart title should be "Nest Nanny 02 (NN-02) Todays Temperature Readings" It should plot data from 4 fields (field 3 - 6) who's names are "Surface Temp", "1/4 Temp", "3/4 Temp", and "Deep Temp". I would like the plot lines for these 4 fields to be different colors (red, orange, cyan, and blue) but on the same chart. I would like Temperature in Fahrenheit to be on the Y axis and Time on the x axis. I would like it to display the last 100 data points. I'd like to use this colororder. colororder(["#FF0000","#FFBB00","#00BBFF", "#0000FF"]) I would like the legend to be to the right of the chart, not contained within the chart. No temperature data should have a value of 50 or less and we can assume it's a sensor issue when this is observed. If a data value is 50 or less, use the value of it's nearest (in the time series) non-zero, non-negative value for that field. The data is stored in the channel as Fahrenheit and does not need to be converted from Celsius. "
Because I did this exercise using an existing plot and had a clear objective in mind, it was relatively quick to iterate four or five times with ChatGPT to refine my prompt. In just a few minutes, the generated plot almost perfectly matched my existing plot. (I xxxx'ed out the channel ID and API key before posting.) For someone who now only occasionally uses MATLAB, this approach saves time and will hopefully allow me to tap into elements of MATLAB that are now beyond my skill level and memory. ;)
ChatGPT generated MATLAB code:
% MATLAB code to create a ThingSpeak Visualization for temperature readings
% Define channel ID and Read API Key
channelID = xxxxxxx;
readAPIKey = 'XXXXXXXXXXXXXXXX';
% Number of data points to retrieve
numPoints = 100;
% Read data from the ThingSpeak channel for fields 3 to 6
[data, time] = thingSpeakRead(channelID, ...
'Fields', [3 4 5 6], ...
'NumPoints', numPoints, ...
'ReadKey', readAPIKey);
% Replace any value 50 or less with the nearest non-zero, non-negative value
for i = 1:size(data, 2)
% Identify indices where the data is 50 or less
badIndices = find(data(:,i) <= 50);
% Identify indices where the data is valid (greater than 50)
validIndices = find(data(:,i) > 50);
% Interpolate to replace bad values
if ~isempty(validIndices)
data(badIndices, i) = interp1(validIndices, data(validIndices, i), badIndices, 'linear', 'extrap');
end
end
% Plot the data
figure;
colororder(["#FF0000","#FFBB00","#00BBFF", "#0000FF"]); % Set the color order
plot(time, data(:,1), 'LineWidth', 2); hold on;
plot(time, data(:,2), 'LineWidth', 2);
plot(time, data(:,3), 'LineWidth', 2);
plot(time, data(:,4), 'LineWidth', 2);
hold off;
% Add labels and title
xlabel('Time');
ylabel('Temperature (°F)');
title('Nest Nanny 02 (NN-02) Todays Temperature Readings');
% Add legend and move it to the right of the chart
legend({'Surface Temp', '1/4 Temp', '3/4 Temp', 'Deep Temp'}, ...
'Location', 'eastoutside');
% Format the time on the x-axis
datetick('x', 'HH:MM:SS', 'keepticks');
grid on;
% Adjust the figure for better readability
set(gca, 'FontSize', 12);
Plot Comparison:

We're thrilled to announce the roll-out of some new features that are going to supercharge your Playground experience! Here's what's new:
Copy/Download code from the script area
You can now effortlessly Copy/Download code from the script area with just a single click. Copy code or Download your script directly as .m files and keep your work organized and portable.We hope this will allow you to effortlessly transfer your work from Playground to MATLAB Desktop/Online.
Run Code directly from the Chat panel
Execute code snippets from the chat section with a single click. This new affordance means saving a step since you no longer have to insert code and then hit run from the toolstrip to execute instead just hit run in the chat panel to see the output immediately in the script area
Enhanced visual Experience
Customize your Playground workspace by expanding or collapsing the chat and script sections. Focus on what matters most to you, whether it's AI chat or working on your script.

We hope you will love these updates. Try them out and let us know your feedback.
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.

Give it a try, provide feedback on the output, and check back often as we make improvements to the model and overall experience.
The MATLAB AI Chat Playground is open to everyone!
Check it out here on the community: https://www.mathworks.com/matlabcentral/playground

The MATLAB Answers community is an invaluable resource for all MATLAB users, providing selfless assistance and support. However, with the emergence of AI-based chatbots, like chatGPT, there may be concerns about the future relevance and utility of the MATLAB Answer community. What are your thoughts?