Respondida
How to extract data from structure with 1*1 and 8761 field and each field has two rows? I need one of the rows
load('val.mat'); f = fieldnames(val.Space_101.Glare_Sensor_1) % get % val.Space_101.Glare_Sensor_1.x0.x0_0 % val.Space_101...

más de 4 años hace | 0

| aceptada

Respondida
Variables doesn't update after running the code.
This line: fprintf('It's right!!') contains a syntax error. So, instead of that sentence being printed, you will see an error ...

más de 4 años hace | 1

| aceptada

Respondida
Plotting a variable in a for loop
I only see one for loop. X is your audiorecorder object, and x is apparently the recorded audio data, but the relation between ...

más de 4 años hace | 1

Respondida
Insert two boxplots into one graph
If you use the same parameters for the combined boxplot as you did for the individual ones (i.e., use 'Whisker', inf), does that...

más de 4 años hace | 0

| aceptada

Respondida
From table generator unit combination of on and off I want to sum the values of the on generator capacity
You can read the data in that spreadsheet into your MATLAB workspace using readmatrix or another function, and then once you hav...

más de 4 años hace | 0

| aceptada

Respondida
How to extract audio file from the code which produces a sound with sound function.
You can use audiowrite to save data to a .wav file.

más de 4 años hace | 1

| aceptada

Respondida
Creating functions to use inside for loops - birthday paradox simulation
If I understand what you want to do, you can create an m-file called get_k_random_days.m (or whatever you want to call it), with...

más de 4 años hace | 0

| aceptada

Respondida
Function definitions in a script must appear at the end of the file. Move all statements after the "bandstop2" function definition to before the first local function definitio
@Sherif Aly Thank you for the m-file. That's a script, and like the error message says, function definitions in scripts must be ...

más de 4 años hace | 1

Respondida
how to give legend according to excel data headers
One way to get the headers out of the .xlsx file: [values,str_values] = xlsread('test.xlsx') How to apply that in your code: ...

más de 4 años hace | 0

Respondida
Split matrix into square cells
% (x,y) in units of m, presumably xy = [1 2 3 12 56 7; 4 5 6 5 6 8; 7 8 93 43 65 3; 7 8 93 43;]; ...

más de 4 años hace | 0

| aceptada

Respondida
finding if number(iteration) is the sum of 2 numbers inside same array - matlab
Here's something that may be close to what you want to do: X = [20 40 50 60 80 100]; ismember(X,sum(X(nchoosek(1:numel(X),2)...

más de 4 años hace | 0

Respondida
Multiple outputs of a single function in a single array
P=exp(-0.152+0.859.*6.5-1.803.*log(10+25)); a=linspace(0,3); for ii = 1:numel(a) b=(log(a(ii))-log(P))./0.57; fun=@(...

más de 4 años hace | 1

| aceptada

Respondida
How can I plot the same index from two arrays?
T_start1 = {182 444 392 201 155}; %start time T_end = {728 938 674 638 702}; %end time ydata = [cell2mat(T_start1); cell2...

más de 4 años hace | 1

| aceptada

Respondida
DATA COMBINATION AND ARRANGEMENT
D = -.0174+.0002*(0:4); E = 370+ 1*(0:6); F = 177+ 1*(0:6); G = 0.01+.0005*(0:4); [GG,FF,EE,DD] = ndgrid(G,F,E,D); DEFG...

más de 4 años hace | 0

Respondida
access elements of vector within struct
"Is it absolutely necessary to copy the previous values of S.A into a temporary variable as above?" No, it's not necessary. yo...

más de 4 años hace | 1

| aceptada

Respondida
How do i fix line length errors in matlab
If I understand correctly what you are trying to do, it is to fill in a 2D character array YLabel1, each row of which correspond...

más de 4 años hace | 0

Respondida
Read a Special Text File
% read file into character vector data data = fileread('textfile.txt'); % remove the first two lines idx = find(data == newli...

más de 4 años hace | 1

Respondida
Draw from cartesian xy-data a spiral
M = readmatrix('spiral'); plot(M(:,2),M(:,3)); % x, y

más de 4 años hace | 1

| aceptada

Respondida
i have a single row vector contains 0s and 1s and want to convert every 3 bits into integer how can i do that??
You say you want [010,111] as a result: x=[0 1 0 1 1 1 ]; xx = reshape(x,3,[]).'; y = zeros(1,size(xx,1)); for ii = 1:size...

más de 4 años hace | 0

Respondida
Why is my p-value matrix after using corrcoef filled with NaN?
Columns 5, 6 and 7 of Hmeas are all NaN, so even with 'rows','complete', there is nothing you can get but a NaN result. load('h...

más de 4 años hace | 1

Respondida
its giving me an error when making calculator app in app designer
The error says, "'Value' must be a double scalar." [emphasis added]. The error is happening because f is not a scalar, since it...

más de 4 años hace | 0

Respondida
create vector in for loop and then need to store vector in a matrix one after another
Is this what you mean? clear all v = []; for a=1:0.1:2 k1=a; for b=1:0.1:2 k2=b; v(end+1,:)=[k1 k...

más de 4 años hace | 0

| aceptada

Respondida
Finding the index of the first significant decimal.
v = 0.85324; s = 0.0281234; s_rounded = round(s,1,'significant') v_rounded = round(v,-floor(log10(s_rounded))) v = 85.32...

más de 4 años hace | 0

| aceptada

Respondida
Giving different colors in skyplot when default colors repeat
When you set the ColorOrder of gca before calling skyplot, you are setting properties of the current axes, whatever it is. Then ...

más de 4 años hace | 0

| aceptada

Respondida
uitable background outside cells
The white background outside the cells of the uitable is part of the uitable itself. Unfortunately, setting that color is not su...

más de 4 años hace | 0

| aceptada

Respondida
how to draw contour plot
There are a couple of problems. First is the use of linspace. The arguments to linspace are (min value, max value, number of po...

más de 4 años hace | 1

Respondida
How to convert 25 columns and 6 rows excel sheet into a matrix?
Use readmatrix to get a matrix of data out of that sheet. Or use readtable or readcell if you also want the header row(s) if any...

más de 4 años hace | 0

Respondida
How to improve plot
semilogy comes to mind.

más de 4 años hace | 0

Respondida
Creating a GUI to dictate caxis values
Yes. Define callback functions for your sliders. In the callback functions, get the 'Value' of the slider and use that to set th...

más de 4 años hace | 1

| aceptada

Respondida
Maxk gives an incorrect result
For the case that i == 1 you have: maxk(m(1:n),2) m(1:n)is the first n elements of m (going in column-major order, which is wh...

más de 4 años hace | 0

| aceptada

Cargar más