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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 1

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 0

| aceptada

Respondida
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: [...

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

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

más de 4 años hace | 0

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

más de 4 años hace | 0

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

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

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

más de 4 años hace | 1

| aceptada

Respondida
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))

casi 5 años hace | 0

| aceptada

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

casi 5 años hace | 0

Cargar más