Respondida
How to update table with new data with a GUI
% create (pre-existing) table: t = uitable( ... 'ColumnFormat',{'char' 'char' 'numeric' {'Coke' 'Pepsi' 'Dr. Pepper'} 'log...

más de 4 años hace | 0

| aceptada

Respondida
Define the vectors x equals open square brackets table row 1 2 3 4 5 end table close square brackets and y equals open square brackets table row 3 6 9 12 15 end table close sq
List of relevant mathematical operations in MATLAB (continued from here): Use log10 to take the base-10 logarithm of something

más de 4 años hace | 0

Respondida
How to evaluate this expression
Here's a list of relevant mathematical operations in MATLAB, for reference: Use cos for cosine when the angle is in radians Us...

más de 4 años hace | 0

Respondida
Trying to plot 4D data
In the sample image, it looks like Z = U, i.e., the color of the surface corresponds to a U-value which is equal to the Z-value ...

más de 4 años hace | 0

| aceptada

Respondida
How do you plot with missing data?
If you know where the missing element(s) belong(s), put NaN(s) there, which will give you a disjointed line: Year = [2000 2001 ...

más de 4 años hace | 0

| aceptada

Respondida
I am currently in the middle of an assignment in my coding class and I need help or suggestions.
The correct syntax for that last line is: [~,~,ALL] = xlsread('WeatherData.xlsx'); The two "~" say to ignore the first two out...

más de 4 años hace | 0

Respondida
Index in position 2 is invalid. Array indices must be positive integers or logical values.
This error happens because some element of IY is zero (could've just as easily been IX). That happens because round(N*IY) return...

más de 4 años hace | 0

| aceptada

Respondida
Problem with sum in cell
y = repmat({randn(1,99)},5,2000,5); % making a cell array like yours yf = mean(vertcat(y{:,1000,1}),1) % performing the mean ...

más de 4 años hace | 1

| aceptada

Respondida
Plotting powers of 10 on the colorbar
You can use naturlal log (log) or base-2 log (log2) (but I think log10 makes the most sense): col = colorbar('XTickLabel', {'10...

más de 4 años hace | 1

Respondida
How to store elements into a row of an array with for loop?
dates(k,:) = [day month]

más de 4 años hace | 0

| aceptada

Respondida
How can I use the values from the same position in two different matrices as the row and column subscripts for a third matrix?
A=[1 3 2 2 2 1 3 1 3]; B=[2 2 2 1 2 1 3 3 2]; C=[120 234 60 41 248 184 94 194 200]; D = C(su...

más de 4 años hace | 0

| aceptada

Respondida
How to efficiently extract 2-D data from multiple text files and save it as a single 3-D variable?
Using sprintf to construct your file names will make that easier. Also, you only need one additional loop (loop over years) to w...

más de 4 años hace | 1

| aceptada

Respondida
How do I convert a vector into an Nx1 cell array of varying-length vectors?
A = [1 2 3 4 5 6 7 8 9 0]; % sizes = [3 3 3 1]; nA = numel(A); % get as many groups of size 3 as you can from A: sizes = 3...

más de 4 años hace | 0

| aceptada

Respondida
How to remove horizontal spacing between subplots?
It looks like plotting the alphaShapes (e.g., LITS31) sets the DataAspectRatioMode of the axes to 'manual' so that although the ...

más de 4 años hace | 0

Respondida
Title for a color bar
col = colorbar('XTickLabel', {'10^{10}', '10^{11}', '10^{12}'}, 'XTick',log10(1e10):1:log10(1e12)); caxis([log10(1e10) log10(1e...

más de 4 años hace | 2

| aceptada

Respondida
Recompose stacked column cell vectors into adjacent row cell vectors
Here's one way: varargin = { [1;2] ["cat";"dog"] }; % convert each element of varargin to a (2x1) cell array: temp = cellfu...

más de 4 años hace | 0

| aceptada

Respondida
How to convert a col array into a struct array field?
a = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]; % 10-by-1 struct array (doesn't need to have a field % 'a' - doesn't need to have any ...

más de 4 años hace | 0

| aceptada

Respondida
Sum of every column with every column
% a small example to test with % the four loop way: ma = 2; na = 3; mb = 4; nb = 5; A = randn(ma,na,3); B = randn(mb,nb,3...

más de 4 años hace | 0

| aceptada

Respondida
Matrix that changes size
One thing you can do is to pre-allocate COORD to be the correct size after NJ is input by the user. (And if this code is used in...

más de 4 años hace | 0

Respondida
Preallocation Problem in for loop
If you know that every element of c has the same number of instances of 'x(...)', i.e., you know extractBetween returns the same...

más de 4 años hace | 0

| aceptada

Respondida
How to aviod the following for loops
N=1000; M=200; K=256; U=rand(N,M)+1i*rand(N,M); V=rand(N,M)+1i*rand(N,M); B=rand(N,K); const_c=2; const_d=0.5; % no lo...

más de 4 años hace | 1

| aceptada

Respondida
App Designer ListBox ValueChanged Callback with multiselect 'on'
Try this (note the square brackets [ ]): % Use array of double to index into data struct and get all of % the runs for the tes...

más de 4 años hace | 0

| aceptada

Respondida
Surface AlphaData not working as expected
You can set AlphaDataMapping to 'none' to get those Alpha values to be interpretted correctly: % generate grid [x,y] = meshgri...

más de 4 años hace | 1

| aceptada

Respondida
How to extract numbers either side of a decimal place
X = [1;2;3;4;5.4700;6;7;8;9.4100;10;11;12;13;14;15;16.4200]; X_int = fix(X); X_frac = X-X_int; X2 = sort([X_int; round(X_fr...

más de 4 años hace | 1

Respondida
How can I print text opposite the number I found in column 1?
L = [11 49 0.8]; % lib=xlsread('newlib.xlsx') % just need to read the file one time [lib,txt,raw] = xlsread('newlib.xlsx') fo...

más de 4 años hace | 0

| aceptada

Respondida
How to display a matrix of matrices?
Your variable grid is what's called a cell array. Specifically it is a 3-by-3 cell array of 2-by-1 numeric vectors. format comp...

más de 4 años hace | 0

| aceptada

Respondida
I do not know how to transfer data from a "sym" to a matrix
You can use double(): A = sym('a',[2 2 2]) A = equationsToMatrix(A) double(A)

más de 4 años hace | 0

| aceptada

Respondida
How to move colorbar inside the subplot ?
Here's how to do some of the things you don't have yet: data = (1:10)+randn(1,10); ylimits = [floor(min(data)) ceil(max(data))...

más de 4 años hace | 0

| aceptada

Respondida
Building a bank of typed letters MATLAB app
You can try this: function ButtonPushed(app, event) val = string(app.TextArea_2.Value); new_val = string(app.EditFiel...

más de 4 años hace | 0

| aceptada

Respondida
plot 2D gride
x = 1:15; y = 1:15; % some 225x1 Pressure values: Pressure = reshape(5000-abs(2*x-y.'),[],1); size(Pressure) % reshape Pres...

más de 4 años hace | 0

Cargar más