Answered
How to add data to cursor tip, BUT each piece of data is from a separate computation or table lookup. (Not the idx, not the coordinates.)
One way to do that is to use the array Payoff as an input to myDataCursorCallback. Something like this: % Curse02.m % Add data...

2 years ago | 0

| accepted

Answered
How to perform elementwise multiplication between two matrices with different size or summation between two matrices with the same size
f = 1:10; x = -22:1:22; y = -22:1:22; [u,v] = meshgrid(x,y); whos Note that u and v are 45x45 matrices, so each has 2025 el...

2 years ago | 1

Answered
contourf plot value not corresponding to the legend bar value
"It looks like anything above .25 is blue, and anything below is red." This is happening because of the levels that contourf ch...

2 years ago | 0

| accepted

Answered
Round down to nearest 100
Divide by 100, then floor() or fix() (depending on how you want to handle negative numbers), then multiply by 100. x = 568; ...

2 years ago | 1

| accepted

Answered
Compile multiple cells in a single vector including empty cells as zero elements.
H = { [] [] [5] [] [3] } % original array H(cellfun(@isempty,H)) = {0} % if empty, replace the empty array ...

2 years ago | 0

Answered
Re: "Multilevel access cells data"
"my Cell x is defined as: Cell x = [3x3 double], [4x4 double]" x = {magic(3),magic(4)} % create x x{:} % sh...

2 years ago | 0

Answered
Logical Operator with cell
names = {'ITC','ITD','ITH'}; LOAD = []; for ii = 1:numel(names) LOAD = [LOAD; str2double(reg_freight_train(contains(reg_f...

2 years ago | 0

Answered
populating the cells of a 10*1 column vector cell array
You can try this, where filename is the (absolute or relative) path to your spreadsheet file: M = readmatrix(filename); % M: 10...

2 years ago | 0

Answered
UITable Individual Cell Editing in App Designer
"when a value was changed and a new row was added the cell would go back to the original value" Because ADDButtonValueChanged d...

2 years ago | 0

Answered
Can I arrange a double array into cell array based on discontinuity of values?
a1=[1 2 3 4 5 10 11 12 13 18 19 20 21 22 23]; a2 = split_vector(a1) a1=[1 2 3 4 5 6 7 8 9 10 11 12 13 18 19 20 21 22 23]; a2 ...

2 years ago | 0

Answered
How to access and perform calculations on cell array of durations
% a table where one column is a cell array of durations: t = table([10;13;16],num2cell(duration([0;1;2],[0;0;0],[0;0;0])),'Vari...

2 years ago | 0

Answered
how to average over specific dates
% a datetime vector spanning several years: dt = datetime('14-Jul-2018 00:01:00'):datetime('14-Jul-2024 00:01:00') % wave heig...

2 years ago | 0

Answered
groupcounts and sum of data in another array in the same order
A = [10, 11, 12, 10, 11, 12, 13, 11, 15, 10], B = [0.5, 1, 1, 0.5, 0.5, 0.5, 1, 1, 1, 0.5] [counts,vals] = groupcounts(A(:)) s...

2 years ago | 0

| accepted

Answered
Use variable to find column in table
% a table with 5 columns, one of which is a table with 4 columns: t = table(rand(12,1),rand(12,1), ... array2table(rand(12...

2 years ago | 0

| accepted

Answered
drop-down menu in uitable
As the warning suggests, if you want to use ColumnFormat your Data can't be a table. Try using a cell array for Data, as in: pl...

2 years ago | 0

| accepted

Answered
How to plot an elliptic curve in MATLAB?
f = @(x,y)y.^2-x.*(x-a^p).*(x+b^p); fimplicit(f)

2 years ago | 1

Answered
permute with exact repeats
Here's one way: x = [1 2 3]; n = 5; % generate a matrix M whose rows are all possible % sets of n elements from x: m = nu...

2 years ago | 1

| accepted

Answered
Extract row data from a complex data file
Here's one way: filename = 'complex_data.txt'; L = readlines(filename); % n_line = 24; % define line to read str = 'dN [...

2 years ago | 0

| accepted

Answered
Find line containing word in a mixed format txt file
filename = 'file.txt'; fid = fopen(filename,'r'); data = fread(fid,[1 Inf],'*char'); fclose(fid); idx = strfind(data,'$ ...

2 years ago | 0

Answered
2D Random Walk
rand(1,2) produces a 1x2 vector: rand(1, 2) Seems like you want a scalar instead: rand(1, 1) % or just rand() Making that ch...

2 years ago | 1

Answered
How to plot a 2D filled colour contour plot depth profile?
load SALT s = permute(SALT(35,:,:),[3 2 1]); contourf(s) set(gca(),'YDir','reverse') xlabel('Longitude(?) Index') ylabe...

2 years ago | 1

| accepted

Answered
I am trying to get my answer to Display but it wont let me
syms f(x) f(x) = (x^3) - (7*x) + 6; x=solve(f(x)==0,x); fprintf('the roots will be [%s]\n',join(string(x)))

2 years ago | 0

Answered
I am trying to get my answer to Display but it wont let me
syms f(x) f(x) = (x^3) - (7*x) + 6; x=solve(f(x)==0,x); fprintf('the roots will be [%s]\n',strjoin(string(x)))

2 years ago | 0

Answered
I am trying to get my answer to Display but it wont let me
syms f(x) f(x) = (x^3) - (7*x) + 6; x=solve(f(x)==0,x); str = sprintf('%s ',x); str(end) = []; fprintf('the roots will be...

2 years ago | 0

Answered
How to change color of point depending on side of a line?
x = rand(20,1); y = rand(20,1); xv = 0.4; yv = 0.6; colors = [1 0 0; 0 1 0; 0 0 1]; r_idx = x < xv; g_idx = x >= xv ...

2 years ago | 1

Answered
How do I add values to a vector?
If you want to insert a zero element at each of the locations specified by gld_off, in turn, you can do this: X = [0.0001385640...

2 years ago | 0

| accepted

Answered
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
The following uses fscanf, fgets, str2num, and strcmp: filename = 'file.txt'; fid = fopen(filename,'r'); counter = 0; wh...

2 years ago | 0

Answered
Unrecognized function or variable
if Lab5c(i)>Lab5c(i-1) && Lab5c(i)>=Lab5c(i+1) && Lab5c(i)> 488000 If that condition is never true then the block inside will n...

2 years ago | 0

Answered
Change The structure of a Variable
Here's one thing you can try: % loadfile: 1x67 struct with one field, each containing a 2x277 cell array C_temp = struct2cell(...

2 years ago | 0

| accepted

Answered
Plot data from nested structure
load Proj_metrics Something like this may have been what you intended: Nparticipants = numel(metrics.sub); %Create a 3D mat...

2 years ago | 1

| accepted

Load more