Hi Guys
So I have a matrix
a = [16 456 22 85 93;
11 78 310 62 36;
1 66 23 67 405]
how would I add/delete row or column in the matrix? - plot a graph, hold on/hold, turn on grid and label x and y axis?
thank you :)

3 个评论

What exactly is your question? Adding deleting rows/columns is explained exhaustively in the Getting Started chapters of the documentation. You find descriptions there also about how to plot a graph, the hold command, labels and grids. So do you aks to rephrase the documentation? Simply use the help and doc commands.
Stephen23
Stephen23 2016-5-2
编辑:Stephen23 2016-5-2
You got links for all of those topics in answer to your earlier question:
Has something changed since you received (and accepted) that answer?
Adding and accessing elements to arrays is a very basic MATLAB usage that you would be better off learning by doing these introductory tutorials:
We are volunteers, not a private tutorial service: the internet has thousand of MATLAB tutorials that will teach you how to to start using MATLAB.
Hi Stephen
Thank you for your reply, I wanted to ensure that the answers are correct and I am going in the right direction

请先登录,再进行评论。

 采纳的回答

Here you go:
a = [16 456 22 85 93;11 78 310 62 36;1 66 23 67 405];
% Add Row:
a = [a; randi(99, 1, 5)];
% Add Column:
a = [a, randi(99, 4, 1)];
% Delete Row #2:
a(2,:) = [];
% Delete Column #2:
a(:,2) = [];
% Redefine ‘a’:
a = [16 456 22 85 93;11 78 310 62 36;1 66 23 67 405];
x = 1:size(a,2); % Create ‘x’ Variable
figure(1)
plot(x, a(1,:), '-b')
hold on
plot(x, a(2,:), '.-r')
hold off
grid
xlabel('Time (nanoseconds)')
ylabel('Velocity (Furlongs/Fortnight)')

3 个评论

Thank you for taking time to answer this, wanted to ensure that I am using matlab correctly and these answers are great
My pleasure.
When I was in initially learning MATLAB, there were a half dozen of us in the Control Engineering computer lab learning control systems and MATLAB simultaneously. We discovered different things at different times, and helped each other learn both. When it came time to do our own work and not collaborate, we all did well. This was about 17 years before MATLAB Answers began. MATLAB was much smaller then as well, and it was much easier to find information in the documentation (which were all only hardcopy back then, and for the Student Edition, in a single book).
The documentation and materials I have are good, sometimes it just taking another persons view to ensure you're on the right track with answers, can I ask when adding rows/ columns what randi means?

请先登录,再进行评论。

更多回答(1 个)

the cyclist
the cyclist 2016-5-2

1 个投票

Your question is effectively "How do I use MATLAB?"
Rather than explain that here, which might take up a bit of space, let me point you to this tutorial page.

类别

帮助中心File Exchange 中查找有关 Networks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by