how to plot table to line graph with dots ?
이전 댓글 표시
hi guys, i have data from the table as picture below. I want to make line graph from data table which X-axes as 'U1' and Y-axes as 'GlobalFx'.
how to plot ?

채택된 답변
추가 답변 (3개)
Dyuman Joshi
2024년 2월 19일
1 개 추천
Convert the data to double data type, and use indexing to plot the data (Reference for syntax - https://in.mathworks.com/help/matlab/ref/plot.html#d126e1185592)
Image Analyst
2024년 2월 19일
Your numbers have commas in them instead of decimal points. That's probably why it reads them in as character arrays instead of doubles. What are your operating system regional settings? Can you change them so that it reads in the numbers as numbers?
Otherwise loop over those values using str2double to convert them to doubles.
strGlobalFX = pushovertable.GlobalFX(2:end);
strU1 = pushovertable.U1(2:end); % Skip missing first row
for row = 1 : numel(strGlobalFX)
str = strrep(strGlobalFX(row), ',', '.'); % Convert comma to decimal point.
GlobalFx(row) = str2double(str); % Convert to number
str = strrep(strGlobalFX(row), ',', '.'); % Convert comma to decimal point.
U1(row) = str2double(str); % Convert to number
end
plot(U1, GlobalFX, 'b-');
xlabel('U1')
ylabel('GlobalFx')
grid on;
Fangjun Jiang
2024년 2월 19일
plot(pushovertable.("U1"),pushovertable.("GlobalFX"))
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!