The following program is takes the power from 1 to 3 from a given array. How do I get the result just for x3. When I put x3 it gives me the result for x1 I don't want that result I want the result of x3 only. Can anybody give me a hint?
1 view (last 30 days)
Show older comments
function [x1,x2,x3] = powers1to3(n)
x1 = 1:n;
x2 = x1.^2;
x3 = x1.^3;
0 Comments
Answers (1)
Star Strider
on 31 Oct 2014
Use the tilde ‘~’ operator if you do not want those values returned. This syntax will return only ‘x3’:
n = ...
[~,~,x3] = powers1to3(n)
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!