Beantwortet
Create a vector (1,25) with values increasing from 0-24
From what I understood, you want to get a row vector having 25 elements with increasing values in the range [0 24]. For that, u...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
How to color each group of a bar plot into a different color
%Random data mat = randi(20, 16, 3); %Plot bar graph b = bar(mat); n = size(mat,1); %Get color for each group color = ...

mehr als 2 Jahre vor | 2

| akzeptiert

Beantwortet
Intersections between two discretised functions
You can use FEX submissions for this, I have run these two submissions below - InterX, intersections as example - You can als...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
how to plot different horizontal lines over each group of bar plot
Here's a demo - %Random data mat = randi([11 19], 4, 6); %Bar plot b = bar(mat); hold on %Get the x-coordinates of ea...

mehr als 2 Jahre vor | 1

Beantwortet
The product of a vector and a matrix
If I understand your question correctly, you should get the desired output using array multiplication - N=5; A = (1:N).' X =...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
Imported data becomes combination of number and alphabet for 1 decimal places value
Change the display format - y = 1011.8 format longG y Note that this only changes how a numeric value is displayed, not how...

mehr als 2 Jahre vor | 0

Beantwortet
hello, i have such a type of data per 30 days in one file.by using fgets,fscanf,str2num,strcmp i need to plot temp vs height
Use readtable to read the data into a table and use indexing to access and thus plot the data using plot

mehr als 2 Jahre vor | 0

Beantwortet
How can produce this matrix?
M = 3; N = 7; k=2; arr = accumarray([randi(M,1,N); (1:N)].', 1, [M N]) if sum(arr(1,:))<k arr = [ones(1,N);zeros(M-1...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
auto update of text in plot
Convert the script to a function (make appropriate change accordingly in doing so) and call the function for different values of...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Create 2D mask from nonzero values in 3D array
Your data does not have any zeros in it. y = load('3Darray.mat') arr = y.FAtp2_DA; any(arr==0, 'all') any(abs(arr)<1e-6, 'al...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Removing the extra part from the figure entered in MATLAB
Use exportgraphics to save the plot to an image file. Description of the function - "exportgraphics(obj,filename) saves the c...

mehr als 2 Jahre vor | 0

Beantwortet
finding a maximum value in a column of a 2 dimensional matrix
No, that finds the maximum of all values of the 2D matrix. Use indexing to provide the 2nd column of the matrix to max() - y =...

mehr als 2 Jahre vor | 1

Beantwortet
Plots: aligning categorical y-axis labels
Set the yticks using the values in y and modify the yticklabels of the right y-axis accordingly - If the order of labels is e...

mehr als 2 Jahre vor | 1

Beantwortet
Numerical Differentiation using Finite Differences
It's because you over-write the variable x as a symbolic variable. Thus you get the aforementioned error. To solve the issue, ...

mehr als 2 Jahre vor | 1

Beantwortet
How to pass a variable with latex interpreter in the legend?
Use compose to generate the string, modify it and use it as an input to legend(). Note that added \ before \tau. str = compose...

mehr als 2 Jahre vor | 1

Beantwortet
SWITCH expression must be a scalar or a character vector. Error in pathplaninglaila (line 17) switch mode
As the error states, the switch expression is expected to be a scalar or character vector. In your case, you are dealing with te...

mehr als 2 Jahre vor | 0

Beantwortet
How to convert a differential equation str to a equation for dsolve to work with
str2sym only evaluates the input provided, it does not account for symbolic variables/functions defined in the workspace, thus y...

mehr als 2 Jahre vor | 3

Beantwortet
When I drag the image, how can I make both the left and right Y-axis move?
Here's an approach with adding another axis to the same tiled chart object and changing the y-axis location for the 2nd axes to ...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
identify rows with [] within a cell
You should use isempty for checking if an array (of any data type) is empty or not - load('M.mat') M cellfun('isempty', M)...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Shifting columns while filling matrix with data
From what I understood - n=5; %database x = meshgrid(1:n) %matrix y = zeros(n); for k=1:n y(:,1:k) = x(:,k:-1:1)...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
use the if-else loop considering a variable 'char' in the workspace
You can use ischar and isnumeric - out = 'analysis'; % or number if ischar(out) disp('character') elseif isnumeric(o...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
MATLAB Not plotting table in workspace
When you use parenthesis, (), on a table, the output is also a table. Use curly brackets, {}, to access the data inside the ta...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
Surface plot plotting in a square X and Y axis, need it to be rectangular
You can change the aspect ratio of the plotting box - %Ratio chosen for example - x/y/z = 1/0.5/0.75 figure surf(peaks) a...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
How to extract all values along the third axis of a 3d-array using a logical 2d-array?
Change the order of the dimension, and apply the logical indexing to the last two dimensions - a = rand(10,10); a(5,5) = 10 ...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
How to plot a curve when x(3,idx) is within a certain range
In MATLAB, when using multiple conditions to compare, the conditions need to be specified separately - idx = 6.077865<x(3,:) &...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
how to change the marker style of qq plot? If i do it in the same way as that of line plot then it shows error as too many input arguments.
Get the handle of the plot, and make changes accordingly. The first handle corresponds to the data points with the default '+' ...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
How to create line breaks in x-axis tick labels of a boxplot in MATLAB?
Change the TickLabelInterpreter to 'tex'. You can adjust the x-axis fontsize to avoid the overlapping among labels. boxplot(r...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
error using the function 'splitapply'
accumarray will be a better fit here. matrix_out_12 = importdata("matrix_out_12.mat"); matrix_out_98 = importdata("matrix_out_...

mehr als 2 Jahre vor | 0

Beantwortet
omment rearranger une matrce long en une seul ligne
A=[16 3 5 10 9 6 4 15 2 13 11 8 7 12 14 1]; B = resha...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Why am I getting a red message when trying to run this code.
Based on the picture of the code you have attached, there seems to be a typo while defining x0. %typo % v x0 = ran...

mehr als 2 Jahre vor | 0

| akzeptiert

Mehr laden