Answered

Displaying legend for multiple plots

h = get(gca,'Children'); Then select handles of lines you want to add to legend. Say h(1) is handle of a line in 1st group,...

Displaying legend for multiple plots

h = get(gca,'Children'); Then select handles of lines you want to add to legend. Say h(1) is handle of a line in 1st group,...

mer än 10 år ago | 0

| accepted

Solved

Make a random, non-repeating vector.

This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

mer än 10 år ago

Solved

Rotate a Matrix

Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

mer än 10 år ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

mer än 10 år ago

Solved

Find the largest value in the 3D matrix

Given a 3D matrix, A, find the largest value. E.g. >> A = 1:9; >> A=reshape(A,[3 1 3]); >> islargest(A) ans = 9

mer än 10 år ago

Solved

Multiply a column by a row

* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...

mer än 10 år ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

mer än 10 år ago

Solved

Compute a dot product of two vectors x and y

x and y are input vectors, d is a number and contains their dot product

mer än 10 år ago

Solved

First N Perfect Squares

*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];

mer än 10 år ago

Solved

Back to basics 1 - Saving

Covering some basic topics I haven't seen elsewhere on Cody. Given an input variable 'x', save it to disk in a file named 'co...

mer än 10 år ago

Solved

Back to basics 23 - Triangular matrix

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

mer än 10 år ago

Solved

Project Euler: Problem 10, Sum of Primes

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below the input, N. Thank you <http:/...

mer än 10 år ago

Solved

Back to basics 22 - Rotate a matrix

Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

mer än 10 år ago

Solved

Find the sum of the elements in the "second" diagonal

Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

mer än 10 år ago

Solved

Omit columns averages from a matrix

Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

mer än 10 år ago

Answered

gui and work space data sharing

If you want to access data that is in base workspace in your gui functions, use v = evalin('base','name of variable u want...

gui and work space data sharing

If you want to access data that is in base workspace in your gui functions, use v = evalin('base','name of variable u want...

mer än 10 år ago | 4

| accepted

Answered

loop for clock in MATLAB

If you just want a loop with only 3 different intervals maybe this crude method can help Clock15=char('12:00','12:15','12:30...

loop for clock in MATLAB

If you just want a loop with only 3 different intervals maybe this crude method can help Clock15=char('12:00','12:15','12:30...

mer än 10 år ago | 0

Question

Creating a cell array of size n

I need a cell array of size n, like if n is 3, I need C = {'red','red','red'} If n is 100, C = {'red','red',.......'...

mer än 10 år ago | 4 answers | 0

Answered

How do I read the value from an individual cell in a matrix

if u want to read from 'i'th cell, data(i); % in ur case shud be suffice. data(i,:); % gives data in ith row

How do I read the value from an individual cell in a matrix

if u want to read from 'i'th cell, data(i); % in ur case shud be suffice. data(i,:); % gives data in ith row

mer än 10 år ago | 0

| accepted

Answered

Display warning only if the "if "statement is not satisfied

if ~(qs1==q2 | qs1==q3) 'Not ok' end %If u do not like above 1 do this: if qs1==q2 | qs1==q3 else 'Not ok' end ...

Display warning only if the "if "statement is not satisfied

if ~(qs1==q2 | qs1==q3) 'Not ok' end %If u do not like above 1 do this: if qs1==q2 | qs1==q3 else 'Not ok' end ...

mer än 10 år ago | 0

| accepted

Answered

finding the gradient of a graph between two points.

i=find(voltage==3); % this gives index of 3 in voltage vector to calculate corresponding current value at voltage = 3. j=find...

finding the gradient of a graph between two points.

i=find(voltage==3); % this gives index of 3 in voltage vector to calculate corresponding current value at voltage = 3. j=find...

mer än 10 år ago | 0

| accepted

Question

Character array of size n.

How do you create a character array of size n(a variable generated from code).

mer än 10 år ago | 1 answer | 1

Question

Using assignin command in guide

%The below line is in base workspace C = char('red','red','red'); %The below code is in gui created by guide. a = get...

mer än 10 år ago | 2 answers | 0

Question

To set default value of slider in gui

I want to set default value of slider in gui created by guide.I've tried this, 1)In gui_OpeningFcn , is set default value by,...

mer än 10 år ago | 1 answer | 0

Answered

loop for clock in MATLAB

Clock=char('12:00','12:15','12:30','12:45','13:00','13:15','13:30','13:45','14:00'); for i = 1:size(Clock,1) Clock(i,:) ...

loop for clock in MATLAB

Clock=char('12:00','12:15','12:30','12:45','13:00','13:15','13:30','13:45','14:00'); for i = 1:size(Clock,1) Clock(i,:) ...

mer än 10 år ago | 0

Answered

martix with mod question

Explained, for i = 1:n1*n2 % for loop with i increasing from 1 to n1*n2(48 in your case) for j = 1:n1*n2 % for loop w...

martix with mod question

Explained, for i = 1:n1*n2 % for loop with i increasing from 1 to n1*n2(48 in your case) for j = 1:n1*n2 % for loop w...

mer än 10 år ago | 0

Question

Create contents of popup menu dynamically

I want to create a popup menu with contents dynamically,based on value of a variable n in my code. Example:- If n is 2,the co...

mer än 10 år ago | 2 answers | 0

Answered

References and Books on Object Oriented Programming in Matlab

Does this help you, http://www.mathworks.in/support/books/index_by_categorytitle.html?category=18&sortby=title

References and Books on Object Oriented Programming in Matlab

Does this help you, http://www.mathworks.in/support/books/index_by_categorytitle.html?category=18&sortby=title

mer än 10 år ago | 0

Question

Dynamically creating Pop-up menus

Is there a way thru which i can dynamically create pop-up menus, example:- I have a graph with plots of sind(1:360),cosd(1:36...

mer än 10 år ago | 1 answer | 1

Answered

evaluate bessel with plot

You get that error because g is a vector of length 500(reduced from 501 due to diff command you used) & omega is of length 50...

evaluate bessel with plot

You get that error because g is a vector of length 500(reduced from 501 due to diff command you used) & omega is of length 50...

mer än 10 år ago | 0

| accepted