Respondida
How to provide a positive and negative value for the tolerance value?
"I want the tolerance value to be both positive and negative" Use abs. However, you also need to compare the current result wi...

15 días hace | 2

| aceptada

Respondida
Eliminate Nan row in a large matrix
A(any(isnan(A),2),:) = [];

15 días hace | 0

| aceptada

Respondida
Is it possible to realize such loop in MATLAB?
x = 10; n_iterations = 5; results = zeros(1,n_iterations); r = 1; for ii = 1:n_iterations r = r*(x-ii); results(...

16 días hace | 0

| aceptada

Respondida
Combining text with non-zero elements of a 2D array
Here's one way: N=[10 0 0 0 0; 0 20 0 0 0; 10 0 20 0 0; 0 0 0 10 0; 0 0 0 0 30] C={'ABC';'DEF';'GHI';'JKL';'MNO'} n_col = siz...

16 días hace | 0

Respondida
Combining text with non-zero elements of a 2D array
Here's one way: N=[10 0 0 0 0; 0 20 0 0 0; 10 0 20 0 0; 0 0 0 10 0; 0 0 0 0 30] C={'ABC';'DEF';'GHI';'JKL';'MNO'} n_col = siz...

16 días hace | 0

Respondida
Is there a meaningful guideline on when to use parentheses vs square brackets vs curly brackets in writing MatLab code?
If you share a particular snippet of code that is confusing, someone here can probably explain it. (Of course, that code may be ...

19 días hace | 2

Respondida
How do I print a % character into a file
fprintf(app.SessionFile,"%s",str);

19 días hace | 0

| aceptada

Respondida
How do I create a timetable from a file that contains several data columns with associated time columns?
txtArray= {'Sig1_Time' 'Sig1_Value' 'Signal2_Time' 'Sig2_Value' 'Sig3_Time' 'Sig3_Val...

19 días hace | 0

| aceptada

Respondida
Why is my table getting all the same values when it shouldn't?
The basic problem is that R and C are vectors, and the Simulink model appears to only use the first element in that case. The s...

19 días hace | 1

Respondida
how do I load zip file in matlab code?
Use <https://www.mathworks.com/help/matlab/ref/unzip.html unzip> to extract the files from the zip archive. Then read/load the r...

21 días hace | 0

Respondida
How can I write data to a text file in a user-specified location that is already populated with a standard header?
You can call writematrix with 'WriteMode','append' to write the data to a text file that already contains the header. So the co...

21 días hace | 0

| aceptada

Respondida
How to correctly adjust the FaceColor property of patch objects in a figure with a legend?
fig = openfig('cylinder.fig','visible'); There are actually 12 patches in the figure all_patches = findall(fig,'Type','patch')...

22 días hace | 1

| aceptada

Respondida
undo a command in matlab plotting in 2d
In the figure window go to Tools menu > Edit Plot. Using the mouse cursor select the line you want to remove, then either right-...

22 días hace | 0

Respondida
Issue with plotting order
Data = readmatrix("FigureOfMeritResults.xlsx"); % Extract data Date = Data(469:1908,1); FoM = Data(469:1908,3); GHI = Data(4...

23 días hace | 0

Respondida
Plots coming out weird
You likely have pre-existing X and Y variables in your workspace, which are being plotted in their entirety. Since the code show...

24 días hace | 0

Respondida
Separating and indexing (k-wave) datasets to different planes/coordinates
One way to separate the the data for the two sensors is using the following approach % Extraer resultados de sensor1 y sensor2 ...

24 días hace | 0

Respondida
assign the fields of a structure correctly
Assuming the set of table variable names is the same between d1 and app.Preset_UITable.Data (but potentially in a different orde...

24 días hace | 1

| aceptada

Respondida
Why converting from Spherical to Cartesian using the command "sph2cart" gives different values than converting it manually by writing the equations of each coordinate?
Assuming theta is azimuth and phi is elevation, your equations would be (from the documentation): x = r .* cos(phi) .* cos(thet...

26 días hace | 1

| aceptada

Respondida
Turning a 1x3001 array into a 14x3001 array to make two things the same size and perform math on them...
You don't have to explicitly repeat the 1x3001 row vector 14 times in order to add it to the 14x3001 matrix. Here's an example ...

26 días hace | 0

| aceptada

Respondida
how to make figure full axes
Setting the figure's WindowState property to 'fullscreen' may achieve the desired effect, e.g.: fig = figure('Units', 'pixe...

27 días hace | 1

| aceptada

Respondida
Why do I get "Array indices must be positive integers or logical values" error ?
When i is 100, Per(100-i) is Per(0), which causes the error since 0 is not a valid index in MATLAB.

27 días hace | 2

Respondida
Why does Tiledlayout return error when using a figure with datetime as x-axis?
datetime x-axis is supported in tiledlayout. Here's an example: x = datetime(2024,9,3):hours(1):datetime(2024,9,5); y = rand(s...

27 días hace | 1

| aceptada

Respondida
How to use different colormaps for different function in mesh plot.
Here is one way: % data x = linspace(-3,3,100); y = linspace(0,3,100); [X,Y] = meshgrid(x,y); Rho2 = X.*X + Y.*Y; Z = exp(-...

27 días hace | 1

| aceptada

Respondida
Plot multiple graphs on the figure using plot(y,linespec)
Use hold on y_vec_1 = rand(1,10); y_vec_2 = rand(1,15); y_vec_3 = rand(1,20); figure(); plot(y_vec_1,'*-r');%gz; hold on...

28 días hace | 0

| aceptada

Respondida
2×0 empty double matrix
"why is SAB21 returning " 2×0 empty double matrix"?" Because the expression 2:1 evaluates to an empty vector. SAB21 = SB (3:4,...

28 días hace | 0

| aceptada

Respondida
Can I used Unique to find unique x,y,z coordinates in table data?
load('matlab.mat') T = summaryTable1 [g_idx,result] = findgroups(T(:,[1 2 3])); vars_1 = {'meanZm','meanGAIpred'}; vars_0 = ...

28 días hace | 0

Respondida
Import mutilple excel files and save then individually as matlab tables, and finally synchronize the timetables
% specify source and destination directories source_dir = 'C:\Wind_Data_Rows_Deleted_2023\test'; dest_dir = 'C:\Wind_Forecast_...

28 días hace | 0

| aceptada

Respondida
Set current axes by using axes() is not wokring
To plot like that in a uifigure, make the uifigure's HandleVisibility 'on' (it's 'off' by default), e.g.: app.UIFigure.HandleVi...

28 días hace | 0

| aceptada

Respondida
Update UIAxes in App1 after computation in App2
% Button pushed function: GotoApp2Button function GotoApp2ButtonPushed(app, event) app.app1handle = findall(0, 'Name', 'My...

29 días hace | 0

| aceptada

Respondida
Storage columns of data from excel sheet on matlab table cell
"I want to create a matlab table" but you show a cell array. These methods create a cell array as you describe: Method 1: T = ...

29 días hace | 1

| aceptada

Cargar más