Times table that takes a lo and hi values and makes lo to hi times table
1 view (last 30 days)
Show older comments
What I need is to get this to take the first row and columns and multiple each row and columns to produce a times table. I did, at some point, get the rows and columns to multiply each other and proudce the correct answe. However, I can't for the life of me get that code into this one's vector. Help?
function multiTable= timesTable(lo,hi)
n=lo:hi;
x=(hi-lo)+2;
sizeoftable=[0,(lo:1:hi)];
multiTable=zeros(x,x);
multiTable(:,1)=[sizeoftable];
multiTable(1,:)=[sizeoftable];
end
0 Comments
Answers (1)
Voss
on 26 Oct 2022
lo = 6;
hi = 12;
n=lo:hi;
x=(hi-lo)+2;
sizeoftable=[0,(lo:1:hi)];
multiTable=zeros(x,x);
multiTable(:,1)=[sizeoftable];
multiTable(1,:)=[sizeoftable];
multiTable(2:x,2:x) = (lo:hi).*(lo:hi).'
2 Comments
Voss
on 27 Oct 2022
You're welcome! Any questions, let me know. Otherwise, please "Accept This Answer". Thanks!
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!