Réponse apportée
Insert NaN into specific values
s=load('spi_dca.mat'); spi_dca = s.spi_dca; mask=spi_dca(:,4)==0; spi_dca(mask,4)=NaN;

plus de 3 ans il y a | 0

Réponse apportée
How to add rows to string array using a loop
Try something like this: files = dir(fullfile(PDFfolder, '*.pdf')); L = length(files); DataCompiled = strings(L,4); %Prealloc...

plus de 3 ans il y a | 0

Réponse apportée
Add a 45-degree line in a log-glog plot
Well, that's not a log-log plot; both axes are linear. The line does indeed have slope 1. It may not be apparent that the slope...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Code to handle excel using Matlab
Try this: % use the directory where your files are here: input_file_path = 'C:\2021_11_15\Inlet'; % use the directory where...

plus de 3 ans il y a | 0

Réponse apportée
I am not able to fill with the color between 2 lines in matlab
Since x (and consequently y1 and y2) are column vectors, using fliplr does not have the desired effect. Instead you can use flip...

plus de 3 ans il y a | 3

Réponse apportée
waitbar uifigure the message input argument cannot support the char '_'
One way: HdlWaitBar = waitbar(0,'Hello World A\_B\_C\_D...'); Another way: str = 'Hello World A_B_C_D...'; str = strrep(str,...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Table referencing using cell
% some (simplified) tables like yours: data = table({'a';'b';'c';'c';'a';'b';'b'}, ... [3;4;6;8;3;5;4],'VariableNames',{'C...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to input corresponding data from separate matrices
A = [1 2 3 4 5 6 7 8 9 10].'; B = [ 2 3 1 7 9 10 4 6 5 8; 12 43 64 94 27 58 64 13 90 74].'; [ism,idx] = ismember(A,B(:,1)); ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Labelling multiple plots of the same color with a single legend label.
You can set the HandleVisibility to 'off' in one of each pair of plot calls. figure hold on plot(1:10,1:10,'DisplayName','1',...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Why do I receive "All input arguments must be tables."?
EDIT: copyright code removed. Please do not post copyright code on this forum. Original source: https://www.mathworks.com/matla...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Delete rows with "-" in categorial colum
t = table(["some";"strings";"in";"this";"column"],categorical(["Autumn";"Summer";"Winter";"-";"Winter"])) idx = t{:,end} == "...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Plot with 'SeriesIndex' set to 1 forces all lines in the plot call to have the same color and not iterate the color order
matrix=linspace(0,1,100)'*[1:4]; matrix2=linspace(0,1,102)'*(0.5+[1:4]); figure; h1=plot(matrix); hold on; h2=plot(matrix...

plus de 3 ans il y a | 0

Réponse apportée
How can I remove double values in an array
It's better to build C the way you want it from the start: A=[4, 3.40 ; 6, 3.20; 7, 5.50 ; 9, 6.13; 11, 7.18; ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
setting y axis to specific values
This is streamlined somewhat: %ymax max_left = max(left); max_right = max(right); if max_left < 50 && max_right < 50 y...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Matlab - How to plot 2 different columns of excel data for 2 boxplot under 1 x-axis label?
@Zhan An: This answer is essentially the same as what you're trying to do (plot two boxcharts for each x-tick): https://www.mat...

plus de 3 ans il y a | 0

Réponse apportée
I want to move up my boxchart
You can create a single boxchart per boxchart call, with a single column of data, and set its X location as desired. To illustr...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
parse error at x0
Looks like you are missing a single-quote at the beginning of each of your fprintf calls (and an "n" is missing in the last one)...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Error using fgets Invalid file identifier. Use fopen to generate a valid file identifier.
Specify the file names as absolute or relative path names. That is, instead of specifying just the file name "model.apm", if "mo...

plus de 3 ans il y a | 0

Réponse apportée
open multiple pictures from a list with for loops
for i = height(StimulusList) should be: for i = 1:height(StimulusList)

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Break array or timetable into smaller versions and find max value
Here's one way. This finds the first maximum value in each year (for each column of data), and stores the value and the date it ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to reduce its execution time and why the value of e is a column vector?
@Sadiq Akbar: OK. See below. Note that SigVec has T columns because of its pre-allocation, but that SigVec_est has one column b...

plus de 3 ans il y a | 1

Réponse apportée
How split an image into four parts?
% since I don't have your cell array, I make one up: C = repmat({randi([0 255],224,896)},2,10) % split each matrix in C into 4...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to remove a part of a character?
Date = '1938-03-01'; Date(1:4) = []

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How can i filter a table with several variables
% an example table with four columns: dt = datetime(2023,1,(1:10).'); A = string(rand(10,1)); B = string(rand(10,1)); C = ra...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to get the 1×1 cell array?
offset = -20; pos = 10; neg = 5; str = {sprintf('m, %g, %g, L -%g, 0 c 0, 0',offset+pos,offset+neg,neg-0.3)}

plus de 3 ans il y a | 0

Réponse apportée
plotting in 3 for loop's
The reason you don't see any plots coming from this line in the nested 3 for-loops plot(t_vector,RWind,'LineWidth',3) is that ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to vectorize this piece of code by replacing all the for-loops?
Here is a vectorized code that doesn't have to be modified if you change M or N: th=pi/180; u=[40*th 50*th 60*th 70*th]; b=u;...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Sort cell array with matrix
[~,idx] = sort([myCellTest{:,2,:}]; mySortedCellTest = myCellTest(:,:,idx);

plus de 3 ans il y a | 0

Réponse apportée
How to alter entries in one matrix based on another matrix?
One way: A=[0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to compare two matrix?
One way: A=[0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ...

plus de 3 ans il y a | 0

| A accepté

Charger plus