Answered
Use two bsxfun for row and column vector to span matrix without putting in memory
A = rand(1, 1e5); B = rand(100, 1e5); data = ones(size(B)); tic, for k = 1:5 temp = bsxfun(@times, A, B)...

9 years ago | 0

Answered
MatLab is plotting only points?
What about: Data = xlsread('File.xlsx'); P = Data(:,2); n = Data(:,3); Index = [1; 1+find(diff(Data(:,1)))]; ...

9 years ago | 0

| accepted

Answered
ab = double(lab_he(:,:,2:3)); nrows = size(ab,1); ncols = size(ab,2); ab = reshape(ab,nrows*ncols,2);
lab_he(:, :, 2:3) is the [M x N x 2] subarray taken from the [M x N x P] array called lab_he. |double()| converts it to the...

9 years ago | 0

| accepted

Answered
Run different program's in MaTlab through refernce in the main program
Of course you can simply create a main function and call the other functions from there. This cannot be done automagically, beca...

9 years ago | 0

Answered
Mex compiler on windows server
See: <https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2014b_Sup...

9 years ago | 0

| accepted

Answered
I have imported a table with 4 columns and 1000 rows. I want to find the index of a specific row of data (that exists) which I know the values of i.e. [ 74 8.5 9 8.5]. How?
FileData = load('Table.mat'); Data = table2array(FileData.Table); Search = [74 8.5 9 8.5]; index = find(sum(...

9 years ago | 1

| accepted

Answered
How to plot a sphere with given centre and radius?
Really without a loop? This is a bad idea for something, which is definitely a job for a loop. figure axes('NextPlot', '...

9 years ago | 1

| accepted

Answered
Generate plot in the 2nd screen?
See: <https://www.mathworks.com/matlabcentral/answers/16663-is-it-possible-to-viewing-the-figure-window-on-second-display#answer...

9 years ago | 0

| accepted

Answered
Matlab 2016b - Maximizing affects pause
|pause| and |drawnow| trigger an update of all components drawn to the screen. Therefore it is expected, that |pause| uses more ...

9 years ago | 0

Answered
How to compare words from two text files and get output as number of matching words
% Read the files into strings: StrA = fileread(FileA); StrB = fileread(FileB); % Replace all characters, which ar...

9 years ago | 0

| accepted

Answered
Will Matlab 2017b work without Matlab 2017a?
Yes, it works. But sometimes it is useful to have 2 Matlab versions: If an error occurs, where you do not expect one, you can cr...

9 years ago | 1

| accepted

Answered
Vertical lines with text in plot
x = 0:pi/100:2*pi; y = sin(x); plot(x,y); hold('on'); line([1 3 5; 1 3 5], [-10, -10, -10; 10, 10, 10], 'YLimInclu...

9 years ago | 2

Answered
Event function in ode45
Perhaps it is a typo only when defining the event function: opts = odeset('Events', ProjectileEventsFcn); % Fails opts...

9 years ago | 0

Answered
How can I write "words" and time format in a matrix ?
sec = zeros(size(A)); sec(0 < A & A <= 10) = 10; sec(A > 10) = 20; DT = datetime(0, 0, 0, 0, 0, sec, 'Format...

9 years ago | 0

Answered
Calculate average for 0.01 step in first column
You did not specify, if the data are dense. Do you have 10 measurements for all intervals? What is an efficient solution, if the...

9 years ago | 2

Answered
Hi i'm new to Matlab. I have a matrix of 3985* 720, i want to produce a new matrix from this by averaging every 2 rows (1992*720), i would appreciate if someone can help me on this .
data = rand(3985, 720); nOut = floor(size(data, 1) / 2); dataCut = data(1:2*nOut, :); dataAvg = sum(reshape(dat...

9 years ago | 2

| accepted

Answered
How can I convert the number 1 into a date value 20150101 (yyyyMMdd)?
This works but is slow (see comments): A = [ 1 2 3 4 5 731]; num = datenum('31-Dec-2014') + A; vec = sscanf(datestr...

9 years ago | 3

Answered
How can I copy a folder into another folder?
|copyfile('Folder1', 'Folder2')| copies the *contents* of Folder1 into Folder2: cd(tempdir); mkdir('Folder1') mkdir('...

9 years ago | 4

| accepted

Answered
how to set a plot to start at zero
The output in the plot does not depend on the Y values, but on the provided x values: y = rand(10, 10); subplot(1,2,1); ...

9 years ago | 0

Answered
how to calculate the value?
You can examine the parts of the code: % alpha = (-b+real(sqrt(b^2-4*a*c')))/(2*a) a * c' -4 * a * c' b ^ 2 b...

9 years ago | 0

Answered
Visibility of several plot in the same axes by checkmark in GUI
Now try: set(handles.axes1, 'NextPlot', 'add'); % Not "gca" as in my last suggestion handles.handle_plot1 = plot(X1,Y1,...

9 years ago | 1

| accepted

Answered
which filter the function "imgradientxy" use ??
According to the documentation: doc imgradientxy the default method is: 'sobel' (default) While |imgradient| calculat...

9 years ago | 0

Answered
Plot visibility by checkmark in GUI
If |plot| works in an axes with 'NextPlot' set to 'replace' (the default), a new plot replaces the old plot completely. Try this...

9 years ago | 0

| accepted

Answered
replace all the array with NaN if any of the value is NaN
Without a loop and |bsxfun|: A = randi(9, 4, 3, 2); A(6) = NaN; A(:, any(isnan(A), 1)) = NaN;

9 years ago | 2

Answered
Can I have a free trial of the "Computer Vision System Toolbox" without installation of Matlab R2017b (I am currently using R2014a)?
This is the public forum of Matlab and the members are voluntary Matlab users. Only MathWorks can provide trial versions and the...

9 years ago | 0

| accepted

Answered
MATLAB Colors Preferences changes not working
The colors are stored in the file matlab.prf in the folder prefdir Either revert it using the FileVersionHistory, Recent...

9 years ago | 0

Answered
How to loop through several tiff images and reshape them
What is you input? Does "image" contain an [1455 x 1464 x 6] array? If so, use: img = reshape(img, 1455*1464, 6); to get...

9 years ago | 0

| accepted

Answered
How can I identify numbers smaller than zero within the range of computer precision?
The question is not clear: It is not a question of the precision, if a number is smaller than 0. In |4.9536e+14 - 4.9536e+14| th...

9 years ago | 0

Answered
How does a mex function work ?
The C code will *not* work. Therer is no "Const" or "Void" qualifier, no "For" loop, no "Int" type and no "Plhs" variable: C is ...

9 years ago | 1

Answered
Merging data from different matrices with different row numbers by matching date
result = nan(nDates, nCompanies + 1); result(:, 1) = Dates; for iComp = 1:nCompanies aMatrix = <how to get your iC...

9 years ago | 1

| accepted

Load more