Answered
Index of value when you want to check multiple elements at the same time between 2 cell arrays
If I understand the quesiton, you want to find indices in A where the values in B are found when they are in A. You can use ...

4 years ago | 0

| accepted

Answered
How can I generate random varaible from 0 to 1 without including 0?
The rand function generates randum numbers between 0 and 1, not including 0 or 1: https://www.mathworks.com/help/matlab/ref/ran...

4 years ago | 0

| accepted

Answered
Can I Use the matlab in the mobile phone or tablet rather than laptop?
Yes there's information about MATLAB mobile here: https://www.mathworks.com/products/matlab-mobile.html It's pretty difficult t...

4 years ago | 0

Answered
semilogy, loglog do not work in order to set the y axis on a logarithmic scale
When you use the log plotting functions they don't change the axis scale if hold is on. There's a note all the way at the bottom...

4 years ago | 1

Answered
How to plot a matrix containing NaN?
pcolor specifies color at the vertex, which (confusingly) means that you have one less row and column. It does great with NaN th...

4 years ago | 1

| accepted

Answered
How do I combine my function's output matrices into a single matrix?
Your function loops over some values and for each one computes a row vector. To store the row vector in a matrix, specify an i...

4 years ago | 0

| accepted

Answered
How to compute a vector
Here's how I'd break this down. First, let's have a look at what the syntax produced for X: X=[1,2,3;4,5,6] So X is a matrix...

4 years ago | 1

Answered
Stacked plot /waterfall plots to visulaise figures
If you want to put these data into a waterfall, you can do waterfall(e') but that won't get your time axis correct. Using meshgr...

4 years ago | 1

| accepted

Answered
How to plot readed audio files in multiple plots or subplots by MATLAB
It looks like you're as far as getting the filenames, but need to read the data and make the plots. audioread works well for ...

4 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
It looks like when you gave findpeaks a sampling rate it converted the units to time: From the findpeaks documentation page: [...

4 years ago | 0

| accepted

Answered
How can I specifiy the colors when using the group by color option in boxchart?
BoxChart will use the colors in the active 'colororder', you can change which index they use with SeriesIndex but I'd recommend ...

4 years ago | 0

| accepted

Answered
How change 3D plot shape?
The mesh function is good for this in general. Getting the camera angle just right can be tricky, sometimes you can get there ...

4 years ago | 1

| accepted

Answered
converting a binary string into double using commas for separation
How about something like this? k='00101101011010101101101111101110111100000001010000110010011000101111000101001010' str2doub...

4 years ago | 1

| accepted

Answered
How to create a heatmap from recorded positions
I'm not sure if you're asking about collapsing the trajectories to a single value per ship, or just displaying a binned version ...

4 years ago | 1

| accepted

Answered
Error in converting array in double to string
it's pretty confusing, but when you made str you made it as a double array. str = []; class(str) So when you assign somethin...

4 years ago | 0

| accepted

Answered
How to change font type of bar plot labels?
You can set the X Axis Tick Label Interpreter (wow a mouthful!) as follows: ax.XAxis.TickLabelInterpreter='latex' where ax is ...

4 years ago | 0

| accepted

Answered
How to add zeros to the end of a column vector
You can use padarray for this (or you can just do [b; zeros(numel(a)-numel(b),1)]) a = (1:9)' b = (1:5)' c=padarray(b,numel(a...

4 years ago | 0

Answered
How efficient is it to use (end+1) to add a value to an array?
Preallocating an array is far more efficient. Why? Check out this page: https://www.mathworks.com/help/matlab/matlab_prog/prea...

4 years ago | 0

| accepted

Answered
repeated value of a vector
repelem is perfect for this kind of problem: x = [1 5 15 2] repelem(x,2)

4 years ago | 1

Answered
How to set x-axis into HH:MM format?
The B that you list in your snippet doesn't look like times. Here's an example where B is actually a time: A = [24 25 26 27 2...

4 years ago | 0

Answered
[beginner] How do you plot two vectors of diffrent length?
At some level the question is what you expect from the plot. When I look at your y1 vector, I notice that it's got an odd ar...

4 years ago | 0

Answered
Hold on issue for subplots
TLDR: use tiledlayout/nexttile if you have R2019b or later, on older releases you can work around subplot's save/load weirdness ...

4 years ago | 0

| accepted

Answered
Variable not assigned during call to function
I would think your nested function would return a value (which can be the same as the main function if you like). Nested functio...

4 years ago | 1

Answered
Logic in fibonacci series
You can imagine a for loop as running the contained code for each of the values that it's iterating over. Below, I've unpacked y...

4 years ago | 1

| accepted

Answered
How can I save the figures in the subfolder of current directory path?
Your code is failing because you're pasting in the string 'path' instead of the variable path. I wouldn't recommend using try +...

4 years ago | 1

| accepted

Answered
Combine time related columns into timestamp for data in csv
The datestr is perhaps adding confusion? This page has some good information on how to format datetimes: https://www.mathworks....

4 years ago | 1

| accepted

Answered
join a specific column from csv 2 to csv 1
Assuming your CSV files are shaped appropriately, you probably want: C = [A B(:,2)] B(2) refers to the second element in B, ...

4 years ago | 1

| accepted

Answered
How can use randi function for a specific array of numbers?
How about using randi to pick indices into dataSet? Alternatively, if you're not constrained to use randi, just use randsample...

4 years ago | 1

| accepted

Answered
How to create a new matrix from an function performed on another matrix?
Many functions in MATLAB will just accept a matrix: V=[1+0i; 3+4i; 2+3i; 0; 4+3i]; Theta = rad2deg(angle(V))

4 years ago | 0

| accepted

Answered
Saving image in full screen with TiledLayout
Could you set the figure position to be fullscreen, and keep the tiledlayout at the default (which occupies the full figure wind...

4 years ago | 0

Load more