Answered
How to combine vectors based on value?
Regarding your latest comment, a much simpler way of obtaining your D result, assumming that elements of B and C are uniques is:...

11 years ago | 1

Answered
How to select element of matrix that is created with function handle ?
First of all, the code you've written *does not* define any matrix. It defines functions that generate matrices, but until you c...

11 years ago | 2

Answered
Help in naming the file from 001 to 100 with the same extenstion
Option 1: Write a script in matlab, debug it to make sure that it does not result in data loss (like overwriting some files by m...

11 years ago | 0

Answered
Delete a printed char in txt file?
You can't, matlab does not have the facility of shortening a file. The best you can do is read the file, truncate the string, an...

11 years ago | 0

Solved


sort matrix
Given a matrix, sort it for each column, but cannot change the element of each row. for example input = [1 3; 2 4;1 5;3 6]; ...

11 years ago

Answered
How to repeat a random number generation and simulation for 1000 times
doctor_leavingtime = zeros(1, 1000); for repeat = 1:1000 %your code to repeat %... doctor_leavingtime(rep...

11 years ago | 0

Answered
swap only 2 elements in an array
a = randperm(20) swapidx = randperm(numel(a), 2); a(swapidx) = a(fliplr(swapidx))

11 years ago | 0

Answered
Not Enough Input Arguements
Matlab's error message is a bit misleading, the problem is not on line 14 but in your own code. You called |zombies| with less t...

11 years ago | 0

Answered
How can I use a nested for loop to find multiple minimum values in a matrix array?
One possible way is to have |RowVal| and |ColVal| as vectors instead of scalars. You then have two |if| conditions: * |A(i,j)...

11 years ago | 0

| accepted

Answered
Analyzing the occurrences of strings within cells using loops
I'm using a table here instead of cell arrays but the principle is the same. It's not clear if your SUB_IDs are always numerical...

11 years ago | 0

| accepted

Answered
A beginners question on reading matrix array
There are many ways to obtained the desired output. One possible way clothes = {'pants', 'scarf', 'heels','shoes'; ...

11 years ago | 0

Solved


Sum the squares of numbers from 1 to n
For a given value of n return the sum of square of numbers from 1 to n. Example For n = 2 then sum of squares = 5 (1^2 + ...

11 years ago

Solved


the number of inputs
Find the number of the inputs of the function. example y = theinputnumber(x,k); function called theinputnumber has 2 in...

11 years ago

Answered
how to initialise field name of struct array?
How is this question different from <http://www.mathworks.com/matlabcentral/answers/247064-how-to-initialise-a-struct-array-with...

11 years ago | 1

| accepted

Answered
Smallest change for a please
angles = [10 10 270]; changes = mod(diff(angle), 180)

11 years ago | 0

| accepted

Answered
Summing different set of arrays.
As in all likelyhood your criteria is going to change, I would calculate the sum for each unique combination of year column 4 al...

11 years ago | 1

Answered
'Typecasting' COM-objects in matlab?
Use <http://www.mathworks.com/help/matlab/ref/invoke.html |invoke|> to get access to a different interface implemented by the co...

11 years ago | 0

Solved


Add two to x
Create a script such that y equals x plus 2

11 years ago

Solved


Convert yards to feet
The goal of this script is to convert a value given in yards to feet.

11 years ago

Answered
How to get a matrix
What are the values of |m|, |m0|, |w| and the range for |wr|? Your equation works as it should for me when using random values ...

11 years ago | 0

| accepted

Answered
i got 450082 number or data. To process the data i need to make sampling rate to separated that data in a frame. how to process that data in every frame?
There are many ways to do split your data into frames of size 256. Which one is best probably depends on what you want to do wit...

11 years ago | 1

Answered
How to fill larger array with the values of another array randomized?
I don't think there's anything built-in but it's trivial to write: function filledarray = randfill(x, n) %RANDFILL f...

11 years ago | 0

| accepted

Answered
making a running average
x = [1 ,3 ,4 -2, 5 ,6 8, 9, -4, -2]; %Please use valid notation in your question y = conv(x, [1 1 1]/3, 'same')

11 years ago | 0

Answered
I can't figure out how to correctly do a function handle
You basically have a function that takes four inputs (Lb, Lc, W, and D) and you want to pass it to a function that wants a funct...

11 years ago | 1

Answered
Problem with "change directory" in a for loop
Possibly, |sub0010| is not a directory but a file. You never actually check that you're cd'ing to a directory for subdir = ...

11 years ago | 0

Answered
I would like to store files in an array of type A(10,1:853,1:853) using csvread and a for loop. How can I do this?
Assuming all your csv files have exactly the same number of elements: finalletters = 'a':'k'; A = zeros(numel(finallette...

11 years ago | 0

| accepted

Solved


become the batman and save gotham!!!
:\\YOU ARE THE BATMAN//: Batman needs your help to save gotham city from its villains! One day while patrolling the streets...

11 years ago

Answered
how to arrange in order index by number of position
Now that we have clear explanations, it's easy to compute the result of your algorithm. As mentioned in my comments, I'm goin...

11 years ago | 0

| accepted

Solved


Generate the sum of Squares of the given number
|P(n) = 1^2 + 2^2 + ... + n^2| |P(1) = 1| |P(2) = 1 + 4 = 5;| |P(3) = 5 + 9 = 14;| |P(4) = 14 + 16 = 30;|

11 years ago

Load more