Solved

Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

1 year ago

Solved

Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

1 year ago

Solved

Return the first and last character of a string
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

1 year ago

Solved

Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

1 year ago

Solved

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

1 year ago

Solved

Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

1 year ago

Solved

Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

1 year ago

Solved

Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<https://i.imgu...

1 year ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

1 year ago

Solved

Return area of square
Side of square=input=a Area=output=b

1 year ago

Solved

Maximum value in a matrix
Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

1 year ago

Solved

Better Index Number
Let's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, y...

1 year ago

Solved

Pattern Sum
Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k...

1 year ago

Answered
i need to convert data from hourly data to daily data and plot these data
Import using a timetable. https://www.mathworks.com/help/matlab/timetables.html Decide how you want to decimate the data in col...

1 year ago | 0

Answered
Passing parameters to dde23 slows it down
Anonymous functions carry some overhead. I wonder if the way it's parsing the arguments to dde23 is causing it to rebuild the an...

1 year ago | 0

Answered
Concatenate fields of a structure into a matrix
Long-term, it sounds like you might want to consider a different data structure, if that's an option. In the interim, try cell2...

1 year ago | 0

Answered
Error in Integrator is not finite. How can I fix it?
Since this happens at t=0, are you possibly dividing the block's input along the way by something that could be zero on simulati...

1 year ago | 0

Answered
Viewing figure is not possible.
matplotlib takes an explicit "show" command. Try: py.matplotlib.pyplot.show()

1 year ago | 1

Answered
Messagebox warning in matlab
The NCC return value you're getting back is a matrix of correlation values (for Lena, it's 512x512). The string you're passing t...

1 year ago | 0

| accepted

Answered
Printing outputs when running C code in simulink via the coder.ceval function
Not completely sure about this one, but if there is there a way to access the Simulink diagnostics panel from within the C code,...

1 year ago | 1

Answered
save animation ,i need help
Sofiane, Take a look at the VideoWriter and getFrame functions: https://www.mathworks.com/help/matlab/ref/videowriter.html Sp...

1 year ago | 0

Answered
I got this error while running a simulink model
You generally get this error when your simulation has an error that causes one of the states to grow exponentially until one of ...

1 year ago | 0

Answered
Loading and saving variables when using parallel toolbox
File access with parallel workers can be tricky, and in the past I've been successful by creating a separate temp directory per ...

1 year ago | 1

| accepted

Answered
How do I highlight very faint lines from an image?
Have you tried the Hough transform? https://www.mathworks.com/help/images/ref/houghlines.html

1 year ago | 0

Answered
Plot variables with similar names.
Are they already saved variables? If not, can you assign using a cell format instead? The mapping would look something like: v...

1 year ago | 0

Answered
Associate Map container with specific values
Map containers are a type of hash object, but not all MATLAB datatypes are hashable. The keys of containers are limited to a sub...

1 year ago | 0

Answered
How can I plot in dB in Matlab?
Decibels are a ratiometric measurement. For power, as shown in your plot, the reference is 1 milliwatt (denoted from the dBm). 0...

1 year ago | 0

Answered
Does this variable exist
For structures, use isfield() clear a a.M = 'hat'; isfield(a,'M') % True isfield(a,'N') % False For array size, use length(...

1 year ago | 0

Answered
Making the if statement in a for loop display only one iteration of the message
Looks like it takes 25 iterations to converge. Are you looking for it to display at the very end a Success/Failure message? The...

1 year ago | 0

Answered
NEED HELP SOLVING "Array indices must be positive integers or logical values"
Does it need to be a one-liner? If you can grab the x,y coordinate, you could clamp your index points to the box bounds using %...

1 year ago | 0