Assign Slider Value Changing to a vector element in App Designer

조회 수: 1 (최근 30일)
Giovanni Brambati
Giovanni Brambati 2020년 12월 11일
댓글: Giovanni Brambati 2020년 12월 11일
I want to have the input of a slider as an element of the vector f, in order to perform a matrix multiplication Kfinv*f. However Matlab keeps showing me the message "Incorrect dimension for matrix multiplications". How can I fix this?
I show you the code that I'm using in App Designer, the persistent variables are set in a previous ButtonPushed function
% Value changing function: Slider
function SliderValueChanging(app, event)
persistent Ex Ey Kfinv u_c ind_dis Edof n D ndof
Ex_dis=zeros(size(Ex)); Ey_dis=zeros(size(Ey));
e_vm=zeros(n,1);
e_vm_gp=zeros(4,1);
sx=zeros(n,1); sy=zeros(n,1); tau=zeros(n,1); f=zeros(100,1);
u=zeros(1,2*ndof);
changingValue = event.Value;
f(100)=changingValue; %Positioning
u_fs=Kfinv*f; %Reduced solution vector

답변 (1개)

Joel Van Sickel
Joel Van Sickel 2020년 12월 11일
Hello Giovanni,
do you mean to multiply u_fs = Kfinv*f(changingValue)?
right now it is Kfinv*f, where f is [100x1].
that means Kfinv needs to b [mx100] in size, what size is Kfinv?
Regards,
Joel
  댓글 수: 1
Giovanni Brambati
Giovanni Brambati 2020년 12월 11일
I'm very sorry but I just noticed the the problem was not on the slider input but on the matrix Kfinv that was not stored correctly in a previous step, I will try to delete this question now.
Thank you

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

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by