Okay so I've made this for loop and if I turn it into an animated plot it works but when I want it to work as a normal plot all I get is a blank plot as my output how can I fix this?
function [] = hplot(data)
%
hold on
for i = i:numel(data.Time)
plot(data.Time(i), data.X(i))
end
hold off
end

回答 (2 件)

madhan ravi
madhan ravi 2018 年 10 月 19 日
編集済み: madhan ravi 2018 年 10 月 19 日

0 投票

EDITED
data = load('heel_bottom.mat')
x = data.heel_bottom.left.X
time = data.heel_bottom.Time
'on'
size(time)
size(X)
for i = 1:numel(time)
plot(time(1:i), x(1:i),'-ob')
pause(0.1)
hold on;
end
'off'

5 件のコメント

madhan ravi
madhan ravi 2018 年 10 月 19 日
Add the first and last line of your code in my answer
Junior Roth
Junior Roth 2018 年 10 月 19 日
Continues to do the same thing except for this time the axis just move around, but nothing is shown.
madhan ravi
madhan ravi 2018 年 10 月 19 日
Can you upload the datas?
Junior Roth
Junior Roth 2018 年 10 月 19 日
madhan ravi
madhan ravi 2018 年 10 月 19 日
check the edited code now

サインインしてコメントする。

Image Analyst
Image Analyst 2018 年 10 月 19 日

0 投票

Try this:
s = load('heel_bottom.mat')
heel_bottom = s.heel_bottom;
hplot(heel_bottom);
function [] = hplot(data)
numPoints = length(data.Time);
for i = 1:numPoints
fprintf('Plotting point %d of %d.\n', i, numPoints);
plot(data.Time(i), data.left.X(i), '.', 'MarkerSize', 20)
pause(0.05);
hold on;
end
grid on;
hold off
end

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

タグ

質問済み:

2018 年 10 月 19 日

編集済み:

2018 年 10 月 19 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by