Respondida
Unable to perform assignment because the size of the left side is 1-by-2 and the size of the right side is 1-by-3. Error in pso_process_svc (line 31)
Looks like the function limit_chk_process2 returns a 1x3 vector, but you are expecting it to return a 1x2 vector.

alrededor de 2 años hace | 0

| aceptada

Respondida
plotting a 3d graph for a 3d table
M = readmatrix('file.xlsx') x = M(2:end,2); y = M(1,3:end); z = M(2:end,3:end); figure surf(x,y,z.')

alrededor de 2 años hace | 0

| aceptada

Respondida
I tried this code but it gives me an error
u appears to be in degrees, but phi_n appears to be in radians. You need to convert one or the other, and then use the appropria...

alrededor de 2 años hace | 0

| aceptada

Respondida
Find data from txt file
filename = 'file1.txt'; dt = str2double(regexpi(fileread(filename),'dt. (.*) sec','tokens','once')) filename = 'file2.txt'; d...

alrededor de 2 años hace | 1

Respondida
Find a smaller matrix within a larger matrix
small = 2:7; big = [randi(10,2,15); 2:16; 2:7 10 12 13 15 16 19 20 22 23; randi(10,3,15)] idx = cellfun(@(row)~isempty(strfi...

alrededor de 2 años hace | 1

| aceptada

Respondida
The function's input parameter must be a vector or matrix, and the function must add 1 to each element of the input parameter.
If the task were to write a function that multiplies each element of a vector or matrix (or any array) by 2, then a solution mig...

alrededor de 2 años hace | 0

Respondida
I'm trying to convert the text into binary and then i want to make the 4 bits chunks.
Is this what you are going for? message = 'Hello world'; A = dec2bin(message, 8); cc = reshape(A.',1,[])

alrededor de 2 años hace | 0

Respondida
Merging 2 plots that are already saved as .fig files
Something like this might work, assuming each figure has one axes: fig1 = openfig('File1.fig','invisible'); fig2 = openfig('Fi...

alrededor de 2 años hace | 0

| aceptada

Respondida
colorbar label along y-axis instead of x-axis
% generate random data: lon = 0:359; lat = -90:90; tmp2 = 217+96*rand(numel(lat),numel(lon)); contourf(lon,lat,tmp2, 25, '...

alrededor de 2 años hace | 0

| aceptada

Respondida
While Loops and Criteria
I'm not sure why it's always randi(4), when the matrices all have 9 rows. Are you constrained to pulling from only the first 4 r...

alrededor de 2 años hace | 0

| aceptada

Respondida
How can I get my script to calculate the average correctly?
Are you sure you want to take the mean over the second dimension here? % Calculate average depth and average load for each row ...

alrededor de 2 años hace | 1

| aceptada

Respondida
why can't I use uitable to display a table on a figure?
A uitable's Data cannot be a table variable if the uitable is in a figure created with the figure function. See the description ...

alrededor de 2 años hace | 0

| aceptada

Respondida
Why is my figure different when I open it in the Figure Window, compared to that displayed in the results pane of Live Script?
Try saving the uifigure directly at the end of your code: fig_filename = 'output.fig'; % change this to what/where the .fig fil...

alrededor de 2 años hace | 0

Respondida
In app designer, I have a random number generated that is assigned to a variable. If the number is 1, I want the user to be able to choose the value of this variable: 1 or 11
p = [p1 p2]; for ii = [1 2] if p(ii) == 1 while true answer = questdlg('You have drawn an ace! Pleas...

alrededor de 2 años hace | 1

Respondida
I have an error with this code for different number of elements. I'm lost on how to fix it for the proper output.
Transpose the (0:N-1) vector, because you want a column vector, in order to be consistent with the shape of the data variable, w...

alrededor de 2 años hace | 0

| aceptada

Respondida
figure is not being displayed
All the plots in the 2nd, 3rd, and 4th figures are based on scalars. Plotting a scalar is plotting a single point, so it's not g...

alrededor de 2 años hace | 0

Respondida
Need help to run the Matlab code
"No. of Bees" must be a positive even number. "Dim" mut be 1 or 2. "Iteration" must be a positive integer. "Run" must be a posit...

alrededor de 2 años hace | 0

| aceptada

Respondida
how to plot directly from value in app designer?
Assuming those are numeric edit fields called "InsEdit1", "InsEdit2", ..., and "TimeEdit1", "TimeEdit2", ..., then here's one wa...

alrededor de 2 años hace | 0

| aceptada

Respondida
My pie chart wont show up
I assume the problem is that your code calls plotCostBreakdown when it should call costBreakdown (or that the costBreakdown func...

alrededor de 2 años hace | 0

Respondida
Do calculations in csv data one csv file at the time
Something like this; adjust as necessary. % use dir() to get info about the relevant csv files: csv_dir = '.'; F = dir(fullfi...

alrededor de 2 años hace | 0

| aceptada

Respondida
How to write the sum of several matrices in Matlab ?
A = sum(B,3);

alrededor de 2 años hace | 0

Respondida
'Text' must be character vector issue in app designer
You can store the buttons in an array (not a cell array), and you don't need to put x in a cell array either. Also, reshape is n...

alrededor de 2 años hace | 1

| aceptada

Respondida
Matrix dimensions must agree
Read the descriptions on the pcolor documentation page for X, Y, and C - specifically how their sizes must be related. Then che...

alrededor de 2 años hace | 0

Respondida
Fill function not accepting hexadecimal colors
A = [2 2 4 4]; B = [5 3 3 5]; patch("XData",A,"YData",B,"FaceColor","#0000FF");

alrededor de 2 años hace | 0

| aceptada

Respondida
How can I extract an array of numbers from a text-formatted cell array of strings.
data = { '20s' '15m' '' '24s' '' '44s' '3h' '40m' '20s' '' '14s' }; ...

alrededor de 2 años hace | 0

Respondida
How to Convert a Scalar Struct with Vector Fields to a Vector Struct with Scalar Fields?
S.x = [1 2]; S.y = [10 20]; N = numel(S.x); f = fieldnames(S); NF = numel(f); clear A A(N) = S; for ii = 1:N for...

alrededor de 2 años hace | 0

Respondida
How to Convert a Scalar Struct with Vector Fields to a Vector Struct with Scalar Fields?
S.x = [1 2]; S.y = [10 20]; C = [fieldnames(S) , cellfun(@num2cell,struct2cell(S),'Uni',false)].'; A = struct(C{:}) [A.x] ...

alrededor de 2 años hace | 0

Respondida
How to Convert a Scalar Struct with Vector Fields to a Vector Struct with Scalar Fields?
S.x = [1 2]; S.y = [10 20]; C = [fieldnames(S) , struct2cell(structfun(@num2cell,S,'Uni',false))].'; A = struct(C{:}) [A.x...

alrededor de 2 años hace | 0

| aceptada

Respondida
How to interpolate and smooth across values in a matrix, while ignoring NaN values?
Avoid putting NaNs into the scatteredInterpolant: idx = ~isnan(scan2); interpImage = scatteredInterpolant(micsX(idx),micsY(idx...

alrededor de 2 años hace | 0

| aceptada

Respondida
Aligning then subtracting unequal length column vectors
xspots = [ 2600.00 2679.00 2802.00 2924.00 3046.00 3169.00 3291.00 3413.00 3536.00 3658.00 3781.00]; xgrid = [ 26...

alrededor de 2 años hace | 0

| aceptada

Cargar más