top of page

How to plot data using CHAT GPT and MATLAB

How to plot data using CHAT GPT and MATLAB


We will explore how to leverage MATLAB and ChatGPT to generate code for plotting comparison graphs from table data. By combining these tools, we can streamline the process of visualizing and comparing different parameters for multiple methods stored in a table.

Using ChatGPT to Generate MATLAB Code:

  1. Copy Table Data: Begin by copying the table data that you want to visualize.

  2. Visit OpenAI's Website: Go to and access the chat interface.

  3. Prompt ChatGPT: Type a prompt requesting MATLAB code for plotting a graph based on the provided table data.

  4. Copy Generated Code: ChatGPT will generate MATLAB code based on your prompt. Copy the code provided.

Using MATLAB to Plot Comparison Graphs:

  1. Open MATLAB: Open MATLAB on your computer.

  2. Create a New Script: Create a new script in MATLAB where you can paste and execute the generated code.

  3. Paste and Execute Code: Paste the copied MATLAB code into the script and execute it. Save the script when prompted.

  4. Visualize Comparison Graphs: MATLAB will generate comparison graphs for the specified parameters, allowing you to visually analyze the data.

Generating Separate Graphs for Each Method:

  1. Prompt ChatGPT Again: Request MATLAB code for plotting separate graphs for each method using the same table data.

  2. Copy New Generated Code: ChatGPT will provide a new set of MATLAB code. Copy this code.

  3. Paste and Execute in MATLAB: Paste the new code into another MATLAB script and execute it. Save the script.

  4. View Separate Graphs: MATLAB will now display separate graphs for each method, making it easier to analyze individual parameter variations.


By combining the power of ChatGPT and MATLAB, you can efficiently generate code for visualizing and comparing table data. This approach streamlines the process of creating comparison graphs, providing a convenient solution for data analysis and visualization tasks.

9 views0 comments


bottom of page