Risposto
Length command giving rise to array indices must be positive integers or logical values error
The code creates a variable called "length" when this line executes: length(1)=Cr_atoms(i,1)+dx*a; % Angstroms Any subsequent ...

quasi 2 anni fa | 1

Risposto
readtable produces apparent gibberish when reading csv file
Looks like readtable decides the delimiter for a.csv is '_' (underscore). I don't know why. opts = detectImportOptions('a.csv')...

quasi 2 anni fa | 1

| accettato

Risposto
Use vpasolve to solve iterations of the same function when the number of iterations is N
One way is to define a function that takes F, N, and z as arguments and iterates N times to construct F(F(...F(z)...))-z. Then c...

quasi 2 anni fa | 0

Risposto
I am trying to generate code for plotting anti fractals and getting error
Picking z0=c instead of z0=0, correcting the definition of R_base to have 2/theta instead of 2*theta, decreasing the max number ...

quasi 2 anni fa | 0

| accettato

Risposto
I am taking two excel files with similar x value data and want to plot the y values of one of the plots with different colors based on if the second file reads 0 or 1.
warning off all unzip('Data1.zip') unzip('Data2.zip') data1 = readtable('Data1.csv'); data2 = readtable('Data2.csv'); g...

quasi 2 anni fa | 0

Risposto
is it possible to mark significance levels using heatmap?
As far as I know, there is no built-in option to conditionally alter the heatmap data labels, but what you can do is create a he...

quasi 2 anni fa | 2

Risposto
readmatrix collapses blanks/NaNs, but I want to keep those empty cells
Use 'EmptyLineRule','read' to keep the lines that are all-NaN. Using only that option, all sample files are read correctly: ful...

quasi 2 anni fa | 0

| accettato

Risposto
How to remove some xticklabels (but still keeping all the xticks)?
x = 1:100; y = exp(-0.1*x); plot(x,y) ax = gca; ax.XTick = 0:10:100; ax.XTickLabels(1:4) = {''};

quasi 2 anni fa | 1

| accettato

Risposto
Suppressing braces and single quotes of a string matrix
C = { ... ['V1 = 1.01' char(8736) '0' char(176) ' pu']; ... ['V2 = 0.92675' char(8736) '-5.7691' char(176) ' pu']; ......

quasi 2 anni fa | 0

Risposto
Why does pcolor adds a flat lines during a data gap instead of white space?
load FPDO.mat load E_log.mat load T_.mat T_ = T_lepi; The problem is that T_ and E_log are not monotonic: figure subplot(2...

quasi 2 anni fa | 0

| accettato

Risposto
How to plot the continuous linear graph of y(n) + y(n-1) + ... + y(1)
y = [2 -1 1 2 -1 -2 -1 2 3 -2 1]; plot(0:numel(y)-1,cumsum(y),'.-')

quasi 2 anni fa | 0

| accettato

Risposto
How do I convert a symbolic expression to a string?
Here are a couple of options: syms x % the arbitrary expressions phi_1 = x; phi_2 = x^2; % example plot example = [1:1...

quasi 2 anni fa | 1

Risposto
Boxplot divided by color with combined labels
I gather that you want to have the boxes filled as in Alternative 1 and the x-ticks and labels as in Alternative 2. See if usin...

quasi 2 anni fa | 1

| accettato

Risposto
How to put a colorbar between the columns in tiledlayout?
One solution is to use nested tiledlayouts; in this case a 1x2 tiledlayout containing two 3x1 tiledlayouts. figSlices = figure(...

quasi 2 anni fa | 0

| accettato

Risposto
How do I add space between any specific word in string
str = 'double function_name(double name1, float name2, double name3)' newstr = strtrim(strrep(regexprep(str,'([\(\),])',' $1 ')...

quasi 2 anni fa | 0

Risposto
Help organizing legend for bar graph
str is a column vector, so use semicolons (instead of commas) to append new elements str = [str;"went to patch 1 and found food...

quasi 2 anni fa | 0

| accettato

Risposto
How to choose 60 unique coordinates ('A') from 600 coordinates('B'), nearest to 60 other coordinates('C')
C = rand(60,2); B = rand(600,2); [~,idx] = min(sum((permute(C,[1 3 2])-permute(B,[3 1 2])).^2,3),[],2); A = B(idx,:); fi...

quasi 2 anni fa | 0

Risposto
I am unable to successfully pass data in a multiwindow app. Can someone help me understand where I am going wrong?
See if the attached updated mlapp files work the way you intend and the code makes sense.

quasi 2 anni fa | 0

| accettato

Risposto
Changing the colours in heatmap for specific ranges in values
Here's one way: xvalues = {'0 cm','1 cm','5 cm','10 cm','15 cm','20 cm','24 cm','25.3 cm'}; yvalues = {'30 mm','25 mm','20 mm'...

quasi 2 anni fa | 0

| accettato

Risposto
Use specific variable from index to plot answer of equation
If you want to calculate delta_rfO for all combinations of the specified values of T, Q, and Beta, you can permute (or transpose...

quasi 2 anni fa | 0

| accettato

Risposto
Why do I receive error "Not enough input Argument"? Error in CreatePoints (line 7) plotPoints = linspace(lowValue, highValue, 5);
You need to provide inputs to the function when you run it, i.e., you cannot just click on the green Run button because that doe...

quasi 2 anni fa | 1

Risposto
Help with 6.1.1: Array resizing: Removing elements. in Zybook
pendingTasks is passed as input to the RemoveTasks function, so you shouldn't redefine pendingTasks inside the function. That i...

quasi 2 anni fa | 1

| accettato

Risposto
Find index of rows in tables with two conditions doesn't work using &&
Use & to operate on non-scalar arrays: indx = find(T.YPosNanometer == 0 & T.ZPosNanometer == 0)

quasi 2 anni fa | 0

| accettato

Risposto
surface & colormap with "thermometer" map
Seems fine. N = 255; cmap = uint8([N*ones(1,N), N:-1:0; 0:N-1, N:-1:0; 0:N, N*ones(1,N)].'); figure z = peaks(200); surf(...

quasi 2 anni fa | 0

| accettato

Risposto
Multiply different sized arrays by cycling smaller array
Perhaps one of these is what you describe: a = [1,2,3]; b = [4,5,6,7,8]; c = a.'.*b c = a.*b.' c = reshape(c,1,[])

quasi 2 anni fa | 0

Risposto
Concatenating multiple struct fields into a single matrix or array but maintaining dimensions
For demonstration, first I create a similar struct, with 3 fields in A.B.C: N = 3; args = [compose('name%02d',1:N); permute(nu...

quasi 2 anni fa | 0

| accettato

Risposto
Receiving Errors with this code
% Define range of PID gains to explore Kp_range = 0:0.1:5; Ki_range = 0:0.1:1; Kd_range = 0:0.1:0.5; % Define setpoint tem...

quasi 2 anni fa | 0

Risposto
How to accelerate the running speed of this code?
Here's an approach that may or may not be faster (depending on the size of your array X) and may or may not run (depending on th...

quasi 2 anni fa | 0

Risposto
Not able to use imread on images in subfolders
Take the first two outputs from uigetfile (the second output is the location of the selected file), and construct the full path ...

quasi 2 anni fa | 1

| accettato

Risposto
Mean of selected range of a matrix based on a range of values from another matrix
load('data_my.mat') T = table(month,sa,ta,sig); % only sig 27.4 to 27.5 idx = sig >= 27.4 & sig < 27.5; G = groupsummary...

quasi 2 anni fa | 2

| accettato

Carica altro