Answered
Can I change iteration value in following for loop?
Maybe you mean: nf1 = 3; nf2 = 4; panel_no = 1:12; R_vx = rand(144,1); velx = repmat([panel_no.', reshape(R_vx, 12, 12)], ...

3 years ago | 1

| accepted

Answered
How to edit each matrices in a cell?
L1 = 0:5:50; L2 = 5:5:55; % By the way, these are 11 values, not 10 NTG_MeanEmpty = randi([0, 55], 50, 27); n = 11; Analysi...

3 years ago | 1

| accepted

Answered
MATLAB : Add path of parent directory containing a class, called from a child directory
What's wrong with using the absolute path? myPath = mfilename('fullpath'); myParentPath = fileparts(myPath); oldPath = addpat...

3 years ago | 0

Answered
I try to write audiofiles from data which is stored in a struct
folder = 'C:\Users\blabla\Single_Tones\' for i = 1:length(struc) file = fullfile(folder, sprintf('JD(%d).wav', i)); a...

3 years ago | 1

| accepted

Answered
Invalid expression, can anybody help me
What is the purpose of: x=('heart rate'); Afterwards x is the CHAR vector 'heart rate' and you compare it to numerical values....

3 years ago | 0

Answered
i have this error in my code how i can fixed it
The error message is exhaustive already: "Function definition not supported in this context. Create functions in code file." Yo...

3 years ago | 0

Answered
How to record and save myself audio and load it as myvioce.mat file with sample frequncy 5000
Fs = 5000; nBits = 16; nChannels = 1; recorder = audiorecorder(Fs, nBits, nChannels); beep recordblocking(recorder, 2); % ...

3 years ago | 0

Answered
how to change specific row for all file inside a folder?
Two steps: Implement the code to process 1 file. The easies way is to import the file using readlines, remove the last line and...

3 years ago | 0

| accepted

Answered
Export plot as 600dpi png and with variables in the file name
print(gcf, sprintf('p%d.png', iter), '-dpng', '-r600'); % [EDITED], %s -> %d

3 years ago | 0

| accepted

Answered
Fast alternative to assign 0 to NaNs
Avoid calculate A_nan==0 repeatedly inside the loop. Do this once before the loop: C = cell(10, 119); for iC = 1:numel(C) ...

3 years ago | 1

Answered
How to test that a script is running correctly ?
The is no way to prove the correct working of scripts. The danger of interferences between scripts, e.g. by clear all commands, ...

3 years ago | 0

| accepted

Answered
How to give different font size to label values and label names?
Simply specify the font directly: plot(rand(5)) set(gca,'FontName', 'TimesNewRoman', 'FontSize',16,'FontWeight', 'Bold'); xla...

3 years ago | 0

| accepted

Answered
Problem with defining a path to a MATLAB function
Maybe you mean: folder = '~/Desktop/Data/pat01_t1/'; Brain = load_untouch_nii(fullfile(folder, 'Brain.nii')); The first input...

3 years ago | 1

Answered
Conversion of C code to Matlab code
pr = 0.734; n = 1.413e-5; ts = 12 l = 10; w = 5; k =0.02428; for v = 2:2:50 re = (v * 0.277778 * l) / n; nu ...

3 years ago | 1

| accepted

Answered
Is it possible to use a script as a callback or ButtonDownFcn in uicontrol?
'ButtonDownFcn', @(h,e) run('displayText')

3 years ago | 0

Answered
Applying large logical masks to large arrays quickly, row wise
A C-mex version: // File: maskTCopy.c // Compile: mex -O -R2018a maskTCopy.c #include "mex.h" void mexFunction(int nlhs, m...

3 years ago | 0

Answered
Applying large logical masks to large arrays quickly, row wise
Here is a set of different approaches. Run the code to see timings locally on your computer. n = 500000; m = 10; data = ran...

3 years ago | 2

| accepted

Answered
How to compare and merge matrices with same numbers?
A =[ 1 2 3 4; ... 9 6 7 8; ... 10 5 4 7]; B = [ 8 2 3 4; ... 11 6 7 8; ... 5 5 6 7]; m = ismember(...

3 years ago | 0

Answered
How to write a while loop that returns the number of the value you put in?
x = [4575, 893, 78, 12345]; y = floor(log10(x) + 1) Do you really need a loop? x = 10000; n = 0; while x >= 1 n = n + ...

3 years ago | 1

Answered
3 sine waves in 1 graph, same frequency different amplitude
I've replaced your huge 38 MB BMP image by a 48 kB JPEG to improve the speed of loading the thread. Which problem do you have t...

3 years ago | 1

| accepted

Answered
I want the GUI to input a result from another m file in a static text box after clicking a push button.
function msg = YourFcn(your inputs) power_difference = mean(adj_crank_power)-mean(trainer_power); if power_difference < -1 ...

3 years ago | 1

Answered
assigning file from the struct
S = 'X'; A.(S) B.(S) C.(S) D.(S) This is called "dynamic field names".

3 years ago | 0

| accepted

Answered
Matlab not recognizing edits to custom function
Is the a P-coded version of the function? What does which(funcname, -all) show? Maybe there is another version of the function ...

3 years ago | 0

Answered
how to approximate set of point to a given function
Search in the net for "Matlab fit ellipse": https://www.mathworks.com/matlabcentral/fileexchange/3215-fit_ellipse https://www...

3 years ago | 0

Answered
How to store data in a pre allocated array
Of course you overwrite the values, see: Array_Result(i,j)=2; Array_Result(i,j)=2; You canno...

3 years ago | 0

| accepted

Answered
is this code correct?
The equation of an underdamped mass-spring-dashpot system is: This does neither match y = exp((-c/(2*m))*t).*(A*sin(sqrt((k/...

3 years ago | 0

Answered
Below is the question and together with it is my code... but there is always error at the fscanf function.. Can anyone help me pls??
The problem is hidden here: file_id=fopen('file','r') text=fscanf('file','%s',a) % ^^^^^^ ^ ??? fscanf expect...

3 years ago | 0

Answered
How to request user input to press Esc or Enter ?
This will not work. The input command is not sufficient to catch a pressed Esc key. Using the input capabilities of the command...

3 years ago | 1

| accepted

Answered
here, i couldn't get the A,B,C values while using if, elseif conditions. how to get values while using conditional statement?
This cannot work: if i==2:m 2:m is a vector. You can compare i with the vector, but the == operator works elementwise. The...

3 years ago | 0

| accepted

Answered
Error with fopen: I saw a lot of answers saying it has to do with folder permissions, but I should have write permissions because it is a folder I created.
fopen fails to open a file for writing, if: you do not have write-permissing in this folder. You "should" have such permissions...

3 years ago | 0

Load more