답변 있음
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...

거의 2년 전 | 0

| 수락됨

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

거의 2년 전 | 1

답변 있음
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...

거의 2년 전 | 1

| 수락됨

답변 있음
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...

거의 2년 전 | 0

답변 있음
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,[])

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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, '...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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 ...

거의 2년 전 | 1

| 수락됨

답변 있음
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 ...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 1

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
How to write the sum of several matrices in Matlab ?
A = sum(B,3);

거의 2년 전 | 0

답변 있음
'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...

거의 2년 전 | 1

| 수락됨

답변 있음
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...

거의 2년 전 | 0

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

거의 2년 전 | 0

| 수락됨

답변 있음
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' }; ...

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 0

답변 있음
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] ...

거의 2년 전 | 0

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
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...

거의 2년 전 | 0

| 수락됨

답변 있음
Problem 56313. Find Air Temperature from Cricket Stridulation Rate
function y = getTemperature_F(x) y = x+40; end

거의 2년 전 | 0

답변 있음
how to modify data of a matlab figure?
% open figure once for reference openfig('PMSG1_Q1ter.fig'); % constant to multiply one line's YData by const = 0.98; % op...

거의 2년 전 | 0

| 수락됨

더 보기