Solved


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

3 years ago

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...

3 years ago

Solved


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

3 years 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...

3 years 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...

3 years 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....

3 years 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,...

3 years 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 = ...

3 years 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]

3 years 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...

3 years 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...

3 years ago

Solved


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

3 years 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.

3 years 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...

3 years 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...

3 years 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...

3 years 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...

3 years 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...

3 years 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...

3 years ago | 0

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

3 years 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...

3 years 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,...

3 years 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...

3 years 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 ...

3 years 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 ...

3 years 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

3 years 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...

3 years 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...

3 years 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...

3 years 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(...

3 years ago | 0

Load more