Respondida
How can I add a summation column to a heatmap?
Augment your matrix with the row and column sums before sending it to heatmap. Then set the color-limits to the range of your or...

más de 3 años hace | 0

| aceptada

Respondida
How to remove/add elements to an array?
load locs A = locs; B = diff(A); idx = B < 100; A(idx) = []; % remove from both A and B because B(idx) = []; % you need...

más de 3 años hace | 0

| aceptada

Respondida
I run the code, everything works, however the plots only plot two of the graphs and the graphs all look the same.
This may be why only two subplots show up: subplot(2,1, 3) A 2-by-1 subplot grid doesn't have a 3rd subplot, so this line woul...

más de 3 años hace | 0

Respondida
Why is my code not working?
The cause of the error is that the second disp line doesn't have quotes: disp(The student passed the test_11) It should be: d...

más de 3 años hace | 1

| aceptada

Respondida
Why are some csv files imported incorrectly into my cell array?
"Any idea why this might be the case?" It's because the different files have commas and semicolons in different places, e.g. li...

más de 3 años hace | 0

| aceptada

Respondida
Getting outputs from a uifigure when a button is pressed
function [str1,str2,cancel] = Input_categories(details) gui_fig = uifigure('position',[745 420 430 240]); opt_list = {'Option ...

más de 3 años hace | 0

| aceptada

Respondida
How to perform same operation on 100 different table in single loop
for i = 1:100 Data = eval(sprintf('Table%d',i)); % do something with Data ... end However, the better solution is no...

más de 3 años hace | 0

| aceptada

Respondida
How to draw lines in UIFigure designed in App Designer that contains an image
See the example below. % axes and image ax = axes(); im = image(ax,'CData',randi([1 255],100,100)); ax.XLim = [0.5 100.5]; ...

más de 3 años hace | 0

| aceptada

Respondida
writematrix can't save all the numbers in a variable
kidney_right_t1_Mean_ROI1(slice) is a scalar (i.e., a single number, a single element of kidney_right_t1_Mean_ROI1). That is wha...

más de 3 años hace | 0

| aceptada

Respondida
update figure after changing Y axis values
When you set the axes YLim set(axes_objects(i).Children(end).Parent,'YLim',minmax_detr) the cursor lines don't update automati...

más de 3 años hace | 0

Respondida
how to extract specific rows of a .txt file ?
M = readmatrix('input.txt'); M(:,end) = []; [~,~,jj] = unique(M,'rows','stable'); M([false; diff(jj) == 0],:) = []; writemat...

más de 3 años hace | 0

| aceptada

Respondida
Does not plot after the for line. Bold part not working. The first part of the code works well. Kindly help.
Since you are plotting one point at a time, you need to use a data marker. A line consisting of a single point doesn't show up w...

más de 3 años hace | 0

Respondida
How can I make this matrix ?
% your matrix: i = 0; m = 1; j = 2; n = 3; M = repmat([i i i m m j j j n n],4,1) % delete columns 4-5 and 9-10: M(:,[4 5 9 ...

más de 3 años hace | 0

| aceptada

Respondida
Combine multiple columns into one column
If you want to replace the original (unrounded) second column with a rounded version, try this: % a table similar to yours: Pe...

más de 3 años hace | 0

| aceptada

Respondida
How do I average all the values for each column in a cell array?
cellfun operates on the contents of each cell independently, performing the specified function (in this case the function is mea...

más de 3 años hace | 0

| aceptada

Respondida
How do I average columns in cell array if some cells are empty?
load new_mat new_mat % notice the cell in the 4th row, 5th column contains an empty array n_col = size(new_mat,2); averages =...

más de 3 años hace | 0

Respondida
Finding the index of a cell element
A{1} = 'xname1x'; A{2} = 'xname2x'; A{3} = 'xname3x'; idx = find(contains(A,'name1'))

más de 3 años hace | 0

| aceptada

Respondida
obtain element from a non defined array matlab
img_ex = imread('peppers.png'); size_img = subsref(size(img_ex),substruct('()',{1})) % for comparison: size_img_temp = size...

más de 3 años hace | 0

| aceptada

Respondida
How to consider elements from two different column matrix and perform set of arithmetical operation?
% A = [110; 101; 011; 111; 100; 001; 010]; % final result doesn't depend on the % v...

más de 3 años hace | 0

| aceptada

Respondida
Reset pushbuttons by another pushbutton
function box1_Callback(hObject, eventdata, handles) % ... % winner is not defined here % ... if handles.box(1,1)==0 ...

más de 3 años hace | 0

Respondida
How to fix non-alignment issue when plotting multiple axes
Add the following line at the end of your code: ax1.Position = ax2.Position; That seems to fix the problem, but I'm not 100% s...

más de 3 años hace | 1

| aceptada

Respondida
compare two vector with considering Nan
% if the value of any entry in A/B is greater than 1 % or smaller than 0, set it into Nan: A(A<0 | A>1) = NaN; B(B<0 ...

más de 3 años hace | 0

| aceptada

Respondida
How to plot specified semi-circle, rectangle ?
You can create shapes of that type as a single patch object. Below is a function that does it, and here are some examples of it...

más de 3 años hace | 0

| aceptada

Respondida
Plotting multiple scatter points against yticklabel
If I understand what you want to do, it doesn't seem like you need two axes. See below for how to set the YTickLabels correctly...

más de 3 años hace | 0

| aceptada

Respondida
How can you use radio buttons in Guide to change a variable value in a function in the code?
@Kaitlyn: Are the Strings of the radiobuttons really "earthRadioButton", "moonRadioButton", etc.? It seems more likely those are...

más de 3 años hace | 0

Respondida
Regexp to extract standalone numbers from string
Very similar to Steven Lord's answer, but using str2double() instead of converting to string and using double(): str{1,1} = 'X?...

más de 3 años hace | 1

Respondida
How do I compare values in a cell array with values in another array and split the columns accordingly?
load newdata load split_points_rounded N = numel(newdata); split_newdata = cell(1,N); for ii = 1:N temp = reshape([ne...

más de 3 años hace | 0

| aceptada

Respondida
i want to use a function to calculate values using 2 changing inputs
M_inf = [ ... 1.46772 1.49692 1.52613 % ... ]; theta_s = linspace(1,89); gamma = 1.4; NM = numel(M...

más de 3 años hace | 0

Respondida
What is the script to plot the following function? I am trying to plot a vector that exists in the y and z directions, the <> symbolizes a vector. Thanks
r = 0.001:0.001:3; % some r values mu = 1; % some mu value (could be a vector the same size as r) x = zeros(size(r)); y = -...

más de 3 años hace | 0

Respondida
How do I assign a 1x 50 cell array to a struct Scalar structure required for this assignment
S = struct('field1',{1;2;3},'field2',{4;5;6}); % 3-by-1 struct array S(1), S(2), S(3) % show each...

más de 3 años hace | 0

Cargar más