Matlab app designer error related to an array
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
I'm developing a GUI to show DC-motor current and speed signals, now I'm experiencing some code difficulties.
When running the code there's an error msg related to a point used in an array which actually runs perfectly in matlab .m code.
Does anyone know how to get rid of this error?
properties (Access = private)
        current % Current in mA
        speed % Speed in rad/s
        time % Time in s
        current_temp = [];
        speed_temp = [];
        time_temp = [];
        Data
    end

댓글 수: 0
채택된 답변
  Adam Danz
    
      
 2023년 5월 5일
        The table appears to be empty (running from m-file)
MQTTSignal = mqttclient('tcp://broker.hivemq.com','Port',1883)
dataTT = read(MQTTSignal)
dataTT.Data
댓글 수: 6
  Adam Danz
    
      
 2023년 5월 6일
				
      편집: Adam Danz
    
      
 2023년 5월 8일
  
			Thanks for sharing the video! 
> Any other suggestion to improve the plotting view?
Yes, the plotting can be more efficient.  Instead of creating a new line object every iteration, you can update an existing line object. 
% Create line objects
hCurrent = plot(app.UIAxes,nan,nan); 
hSpeed = plot(app.UIAxes,nan,nan); 
% update line objects within the loop
while strcmpi(...)
        ...
        app.current = [app.current;app.current_temp];
        app.speed = [app.speed;app.speed_temp];
        app.time = [app.time;app.time_temp];
        set(hCurrent,'XData',app.time,'YData',app.current)
        set(hSpeed,'XData',app.time,'YData',app.speed)
end
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

