MATLAB Answers

Read value from a graph

조회 수: 42(최근 30일)
Marcel Been
Marcel Been 26 Aug 2014
댓글: Marcel Been 26 Aug 2014
I want to read a value from a graph. I´ve got two matrices (X & Y) and plotted in a graph. I want to know the value of Y when i enter the value of X.
PLEASE help me with a code for this problem.
y =[1;1.09300000000000;1.24200000000000;1.39900000000000;1.56400000000000;
Total=[matrix1 matrix2];

  댓글 수: 0

로그인 to comment.


Ben11 26 Aug 2014
편집: Ben11 26 Aug 2014
Not sure to understand how you would like to 'enter' the value of x, but here is a very simple example:
User_x = inputdlg('Enter a value for x'); % Ask the user what value of x he wants
while ~any(ismember(str2double(User_x),x)) % Check if the entered value is indeed in X.
User_x = inputdlg('Enter a value for x');
X_index = find(str2double(User_x) == x,1,'first') % Find the index in y
Y_value = y(X_index); % Find the corresponding value
Message = sprintf('The corrsponding y-value is %0.12f \n',Y_value); % Write a message
msgbox(Message) % Display the message
Hope that helps!

  댓글 수: 1

Marcel Been
Marcel Been 26 Aug 2014
Thanks for your answer, but it isn't what i need. I want to use this command for my simulink simulation. I attached my programm. I want to search for the 'value' of 'Ethalpy Power_1' in the graph (X, Y) and then the Y-value have to appear. So i can use it in my other graph.
If i've got this command, the chart-block will be removed.
Hopefully you (or somebody else) got the answer for this problem.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by