Answered
reading a binary file into matlab
I think there're other issues despite fixing fid = fopen(fname) filelist = dir('E:\4_models\model1'); filelist = filelist(...

7 years ago | 0

Answered
Conversion to cell from double is not possible
If you want the output to be a cell in the case 2, you have to do this onset_time_second = cell(ratio_channels,4); onset...

7 years ago | 0

| accepted

Answered
How do I use the command 'smooth' to smooth a plot of data I have pulled from two matrices?
Assuming Tmatrix is a 1xN or Mx1 matrix, your use of smooth is correct. But note that you are doing smoothing ONLY on cloudy day...

7 years ago | 0

Answered
Why is my scatter plot blank?
scatter([1 2 3], [1 2 3]); set(gcf, 'renderer', 'painters') Sometimes there's a bug that prevents the graphics card from p...

7 years ago | 0

| accepted

Answered
Using parfor and parfeval in separate pools
I don't think it'll be beneficial nor possible. I get an error like this, since you can't have multiple pools running. Matlab wo...

7 years ago | 0

| accepted

Answered
How to go through multiple different naming folders for the same subfolder name
MainDir = dir(cd); %Instead of cd, use the folder storing your main folders MainDir = MainDir([MainDir.isdir]); %Select onl...

7 years ago | 0

| accepted

Answered
Problem with cell array indexing when using parfor
On first glance, here are some issues. Rewrite the code to prevent accessing cells in dependent or ambiguous manners. Example...

7 years ago | 0

| accepted

Answered
How to increase the memory that MATLAB uses?
This was answered here: <https://www.mathworks.com/matlabcentral/answers/32332-increase-memory-used-by-matlab> Matla...

7 years ago | 1

| accepted

Answered
How to assign error bar at middle of histogram?
Here are some suggestions. To see what each line is doing, remove the ";". %Store your data in cells so you can use loops....

7 years ago | 0

Answered
why i'm getting this error
If the outputs of |impulse| are not scalor values, then store the output into a cell, where each cell can store a different size...

7 years ago | 2

| accepted

Answered
How do i find rows that contain duplicate values only?
x = [1 3 5 6; 2 3 6 4; 9 3 9 6; 3 3 3 3; 1 3 3 4] B = (x == 3); DelCol = sum(B, 1) == size(B, 1); DelRow = sum(B, 2) ...

7 years ago | 0

| accepted

Answered
Finding mean of N matrices excluding 0 and without keeping all of them in memory
Assuming your variables are stored in 500 .mat files, like 'Var-1.mat', 'Var-2.mat'..., and your variable name is called "Data" ...

7 years ago | 1

| accepted

Answered
How to add values to a matrix using for and if?
MP = [1 2; 2 1; 4 1]; nm = max(MP(:,1)); %OPTION 1: for loop MP2 = zeros(nm, size(MP, 2)); ...

7 years ago | 2

| accepted

Answered
parfor: why is 2x memory being used for sliced variable?
Seems good to me. The memory consumption may not always be due to copying the entire cube_cell to all worker. Initializing a ...

7 years ago | 0

| accepted

Answered
How to stop a plot when values get to negative.
Set the z-axis limit to stop drawing below or above certain ranges z = rand(10,10); x = linspace(0,1,10); y = linspac...

7 years ago | 0

| accepted

Answered
Plotting only the part of matrix where a condition is met over consecutive rows
Data = [ 1 4 2 5 3 6 4 8 5 8 6 8 7 8 8 8 9 8 10 5 11 9 11 9]; ...

7 years ago | 1

| accepted

Answered
how to format the axis of the plot?
%OPTION 1: Overwrite the XTickLabel property of the axes. (Simpler code but messy plot) plot([1:10]*10^6, 1:10) XTick = ...

7 years ago | 0

| accepted

Answered
Is there a way to remove or rename a variable in a big MAT file?
You can use MEX code to delete a variable from a .mat file, but then you still have to save the variable via -append feature. Th...

8 years ago | 1

| accepted

Answered
How to generate multiple graphs per page in several pages in one loop?
N = 8; A = rand(100, N); %N is an integer number > 0 % I don't think you need this: % varnames_i = {'1','2','3','4'...

8 years ago | 0

| accepted

Answered
Convert Matlab function to Mex file - For loop conversion
1st issue is that you called mxCreateDoubleMatrix BEFORE Ixyzlength was initialized. Also, mxCreateDoubleMatrix 1st input takes ...

8 years ago | 1

| accepted

Answered
object orianted programing (OOP ) cant understand
Here are some suggestions for improving the code. See the comments in %. classdef main_code_oop < handle %make handle the ...

8 years ago | 0

Answered
how to solve " Undefined function 'lt' for input arguments of type 'tf'. Error in ftfs (line 5) while (t < tf) ?"
The problem lies in understanding the scope of each variable used in Matlab. Here's a read on that: <http://matlab.izmiran.ru/h...

8 years ago | 1

| accepted

Answered
While loop: value increases, break if not.
You could use a *while* loop instead to run until a conditions is met, and it'll automatically break. i = 2; while x(i) ...

8 years ago | 0

| accepted

Answered
fullfile returns error. how to properly use it to perform this code below
Seems like |ext| is a logical value with the value of 1 or 0. The following will give you the same error message: ['a' 1>0]...

8 years ago | 0

| accepted

Answered
how to evaluate a function in string with parfor?
For str2func, you also need to include the "@(var1, var2, var3, ...)" string. This is used to tell Matlab what part of the strin...

8 years ago | 0

| accepted

Answered
Round RBG values to nearest multiple of 50
Try this (no for loop needed): RGB = [1 51 76 105 145 160 190 205]; RGB50 = round(a/50)*50; RGB50 = 0 50...

8 years ago | 2

Answered
im trying to write a code that switches each pixel with the average of its surrounding pixels. this is the code i wrote. for some reason it wont let the value of x go over 255. any help?
Image data can be stored in different data types: uint8, uint16, uint32, and double. Your image is in uint8 format (8bit per pix...

8 years ago | 0

Answered
Is there a way to convert MEX file into original C++ code
As discussed before in this Q&A link, it's VERY HARD to decompile a compiled mex code. <https://www.mathworks.com/matlabcent...

8 years ago | 0

| accepted

Answered
How I could fix this error? Subscript indices must either be real positive integers or logicals.
When accessing a variable, you cannot use fractional values or values <= 0 when used as variable indices. Matlab only accepts in...

8 years ago | 1

| accepted

Answered
How can I embed my .m file(function) in my GUI?
As @Adam mentioned, convert your user string to a function handle via parsing. Try this example and see if it works for your cas...

8 years ago | 0

| accepted

Load more