Answered
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...

4 years ago | 0

| accepted

Answered
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 ...

4 years ago | 1

| accepted

Answered
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 ...

4 years ago | 1

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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.

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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 ...

4 years ago | 1

Answered
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: ...

4 years ago | 0

Answered
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;]; ...

4 years ago | 0

| accepted

Answered
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)...

4 years ago | 0

Answered
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=@(...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

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

4 years ago | 1

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

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 0

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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 ...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 0

| accepted

Answered
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...

4 years ago | 1

Answered
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...

4 years ago | 0

Answered
How to improve plot
semilogy comes to mind.

4 years ago | 0

Answered
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...

4 years ago | 1

| accepted

Answered
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...

4 years ago | 0

| accepted

Load more