필터 지우기
필터 지우기

Decrease time to upload a figure

조회 수: 1 (최근 30일)
Jorge Pascual
Jorge Pascual 2019년 12월 12일
댓글: Philippe Lebel 2019년 12월 12일
Hi everyone,
I am traying to develop an instrumented insole. I have 5 sensor, where I am measuring the change of voltage that it is generated when the pressure in the sensor change. As the sensor is obviolsy only in one pixel, I want to simulate that the pressure is decreasing around 3-4cm, that following my calcules are about 100pixels.
Pressure_points is a function where I enter the foot image, the radius that I have mentioned (95 pixels in this case), Paux are the coordinates of the five sensors and S are their voltage value, then I obtain an image which name es Pedobarography.
So first of all I start reading the voltage values, and if they are cero, I represent the simple foot, waiting in the second 'while', in order to not repeat every time the same figure. When a chagne in the voltage values is deected in any sensor, the process is repeated, but here is the problem. I have cheked that the function Pressure_points is not the problem because without drawing the heatmap it runs quickly, but when I try to upload the foot heatmap with the sensor changes, it runs very slow because it has to draw everything again.
To sum up, is there any way to draw the changes in the same heatmap quickly, to have these change in real time.
Thanks for your attention.
Jorge.
load Paux.mat;
while bt.Status == 'open'
M=0;
[s1,s2,s3,s4,s5]=Voutput(bt);
if s1==0 && s2==0 && s3==0 && s4==0 && s5==0
S=zeros(1,5);
%Locate the pressure sensor, and the pressure created in each of them
R=1;
[Pedobarography]=Pressure_Points(K1,R,Paux,S);
%Pressure is drawn in mV
[X, h] = contourf(Pedobarography,'LevelList',[0.1:1]);
set(gca, 'YDir','reverse')
colorbar
caxis([0 100])
drawnow
end
while s1==0 && s2==0 && s3==0 && s4==0 && s5==0
[s1,s2,s3,s4,s5]=Voutput(bt);
M=M+1
end
while s1>0 || s2>0 || s3>0 || s4>0 || s5>0
[s1,s2,s3,s4,s5]=Voutput(bt);
S=[s1;s2;s3;s4;s5];
% Locate the pressure sensor, and the pressure created in each of them
R=95;
[Pedobarography]=Pressure_Points(K1,R,Paux,S);
% Pressure is drawn in mV
[X, h] = contourf(Pedobarography,'LevelList',[0.1:20:max(S)]);
set(gca, 'YDir','reverse')
colorbar
caxis([0 max(S)])
drawnow
end
end
  댓글 수: 4
Jorge Pascual
Jorge Pascual 2019년 12월 12일
Thank you Looky, I'm going to try it.
Why Phillipe?
Philippe Lebel
Philippe Lebel 2019년 12월 12일
Starts with "pedo" and ends in "ography". read quickly skipped the middle of the word and made me read twice haha

댓글을 달려면 로그인하십시오.

답변 (1개)

Philippe Lebel
Philippe Lebel 2019년 12월 12일
편집: Philippe Lebel 2019년 12월 12일
In addition to @Looky 's answer, try to remove the
set(gca, 'YDir','reverse')
from the while loop, I'm pretty sure you only need to do it once.
Maybe set a flag in the while loop to call it on the first iteration.
Samething for
colorbar
and
caxis
  댓글 수: 2
Jorge Pascual
Jorge Pascual 2019년 12월 12일
I thought the same, I tryed differents things to do it, but I dind't properly, how would do you that?
Philippe Lebel
Philippe Lebel 2019년 12월 12일
Publish sample data that works with your code. Ill look into it tomorrow.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by