Réponse apportée
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.')

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

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

presque 2 ans il y a | 1

Réponse apportée
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...

presque 2 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

Réponse apportée
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,[])

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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, '...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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 ...

presque 2 ans il y a | 1

| A accepté

Réponse apportée
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 ...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 1

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
How to write the sum of several matrices in Matlab ?
A = sum(B,3);

presque 2 ans il y a | 0

Réponse apportée
'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...

presque 2 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

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

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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' }; ...

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 0

Réponse apportée
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] ...

presque 2 ans il y a | 0

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 2 ans il y a | 0

| A accepté

Réponse apportée
Problem 56313. Find Air Temperature from Cricket Stridulation Rate
function y = getTemperature_F(x) y = x+40; end

presque 2 ans il y a | 0

Charger plus