Get specific elment of result / solution vector

Hi, is there a way to get the last element of the result-vector of some calculation? E.g.: I want to solve a system of linear equations and get the last element of the solution. I could write
temp = A\b;
x = temp(end);
but I want to do that with only one line of code. I tried things like
x= [A\b](end);
but they didn't worked out...
Thanks!

Answers (1)

If you want it in one line
temp = A\b;x = temp(end);
Otherwise you can't do it

This question is closed.

Asked:

on 6 May 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!